-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: bitcoin#24419, #25351, #25466, #25701, #25707, #25733, #25872, #31364, #31305, #31051, partial bitcoin#31306 #6980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
WalkthroughThis pull request is a wide-ranging refactor and cleanup focused on reducing unnecessary copies and improving move semantics across the codebase. Changes include many by-value → const-reference or const-reference → value adjustments, removal or addition of includes and using-declarations, additions to clang-tidy checks, API changes in UniValue to accept values by-value for move-friendly storage, minor test expectation updates and new mempool-aware test flows, and small performance optimizations (reserve/emplace). No functional protocol changes; some public signatures in UniValue and descriptor key-loading were modified. Sequence Diagram(s)Sequence diagrams are omitted because the changes are heterogeneous refactorings and configuration/test updates without a single new control flow path that benefits from visualization. Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas requiring extra attention during review:
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/wallet/walletdb.cpp (1)
887-891: Use const-ref in for-range to avoid copies — good change.No behavior change; reduces allocations when iterating descriptor caches/keys.
Also applies to: 894-902, 904-912
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (49)
ci/dash/lint-tidy.sh(1 hunks)src/.clang-tidy(1 hunks)src/bench/wallet_loading.cpp(0 hunks)src/bitcoin-cli.cpp(1 hunks)src/bitcoin-tx.cpp(1 hunks)src/blockfilter.cpp(1 hunks)src/coins.cpp(1 hunks)src/core_read.cpp(1 hunks)src/init.cpp(1 hunks)src/logging.cpp(1 hunks)src/netbase.cpp(3 hunks)src/node/blockstorage.cpp(1 hunks)src/qt/splashscreen.cpp(1 hunks)src/rpc/blockchain.cpp(1 hunks)src/rpc/mining.cpp(1 hunks)src/rpc/output_script.cpp(0 hunks)src/rpc/rawtransaction_util.cpp(1 hunks)src/rpc/util.cpp(1 hunks)src/script/descriptor.cpp(2 hunks)src/test/base58_tests.cpp(2 hunks)src/test/blockfilter_tests.cpp(1 hunks)src/test/fuzz/txorphan.cpp(1 hunks)src/test/key_io_tests.cpp(3 hunks)src/test/miniscript_tests.cpp(1 hunks)src/test/script_tests.cpp(1 hunks)src/test/sighash_tests.cpp(1 hunks)src/test/transaction_tests.cpp(4 hunks)src/test/util_tests.cpp(1 hunks)src/test/validation_block_tests.cpp(1 hunks)src/univalue/include/univalue.h(1 hunks)src/univalue/lib/univalue.cpp(2 hunks)src/util/message.cpp(0 hunks)src/util/strencodings.cpp(0 hunks)src/util/string.cpp(1 hunks)src/util/string.h(0 hunks)src/util/threadinterrupt.h(1 hunks)src/wallet/bdb.cpp(1 hunks)src/wallet/receive.cpp(1 hunks)src/wallet/rpc/backup.cpp(8 hunks)src/wallet/scriptpubkeyman.cpp(1 hunks)src/wallet/spend.cpp(1 hunks)src/wallet/test/wallet_tests.cpp(3 hunks)src/wallet/wallet.cpp(2 hunks)src/wallet/walletdb.cpp(2 hunks)test/functional/rpc_wipewallettxes.py(1 hunks)test/functional/wallet_balance.py(1 hunks)test/functional/wallet_import_rescan.py(5 hunks)test/functional/wallet_importdescriptors.py(2 hunks)test/lint/run-lint-format-strings.py(0 hunks)
💤 Files with no reviewable changes (6)
- src/util/strencodings.cpp
- src/bench/wallet_loading.cpp
- test/lint/run-lint-format-strings.py
- src/util/message.cpp
- src/util/string.h
- src/rpc/output_script.cpp
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/test/base58_tests.cppsrc/test/blockfilter_tests.cpptest/functional/wallet_balance.pytest/functional/wallet_importdescriptors.pysrc/wallet/wallet.cppsrc/rpc/rawtransaction_util.cpptest/functional/rpc_wipewallettxes.pysrc/wallet/rpc/backup.cppsrc/test/sighash_tests.cpptest/functional/wallet_import_rescan.pysrc/wallet/test/wallet_tests.cppsrc/univalue/include/univalue.hsrc/univalue/lib/univalue.cppsrc/test/transaction_tests.cppsrc/bitcoin-cli.cpp
📚 Learning: 2025-10-25T07:08:51.918Z
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Applied to files:
src/test/base58_tests.cppsrc/bitcoin-tx.cppsrc/test/blockfilter_tests.cppsrc/rpc/rawtransaction_util.cppsrc/univalue/include/univalue.hsrc/univalue/lib/univalue.cppsrc/test/transaction_tests.cpp
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
src/test/base58_tests.cpptest/functional/wallet_importdescriptors.pytest/functional/rpc_wipewallettxes.pysrc/test/sighash_tests.cpptest/functional/wallet_import_rescan.pysrc/wallet/test/wallet_tests.cpp
📚 Learning: 2025-10-03T11:29:36.358Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6838
File: src/governance/signing.cpp:84-85
Timestamp: 2025-10-03T11:29:36.358Z
Learning: After bitcoin#25153 (included in dash#6775), UniValue uses the templated getInt<T>() API instead of the legacy get_int() and get_int64() methods. For example, use jproposal["start_epoch"].getInt<int64_t>() to retrieve int64_t values from UniValue objects.
Applied to files:
src/test/base58_tests.cppsrc/test/transaction_tests.cpp
📚 Learning: 2025-08-19T14:57:31.801Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Applied to files:
src/test/validation_block_tests.cppsrc/node/blockstorage.cpp
📚 Learning: 2025-06-20T23:32:16.225Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6726
File: test/functional/rpc_createmultisig.py:120-120
Timestamp: 2025-06-20T23:32:16.225Z
Learning: In the rpc_createmultisig.py test, the checkbalances() function correctly excludes 9 blocks from the balance calculation: 8 blocks from do_multisig() calls (2 blocks per call × 4 calls) plus 1 block from checkbalances() itself.
Applied to files:
test/functional/wallet_balance.pytest/functional/wallet_importdescriptors.pytest/functional/rpc_wipewallettxes.py
📚 Learning: 2025-02-14T15:19:17.218Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Applied to files:
src/wallet/wallet.cppsrc/wallet/test/wallet_tests.cppsrc/bitcoin-cli.cpp
📚 Learning: 2025-01-14T08:37:16.955Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6530
File: src/validation.cpp:360-362
Timestamp: 2025-01-14T08:37:16.955Z
Learning: The UpdateTransactionsFromBlock() method in txmempool.cpp takes parameters in the order: vHashUpdate, ancestor_size_limit, ancestor_count_limit. The size limit comes before the count limit.
Applied to files:
src/wallet/wallet.cpp
📚 Learning: 2025-08-10T13:52:46.289Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6666
File: test/functional/rpc_netinfo.py:73-81
Timestamp: 2025-08-10T13:52:46.289Z
Learning: In the Bitcoin/Dash test framework, `self.node.extra_args` contains the original startup arguments for a TestNode and is not modified by `test.restart_node()`. Each restart with new `extra_args` doesn't update the stored `self.node.extra_args`, so copying from it always provides a clean slate without accumulated modifications from previous restarts.
Applied to files:
test/functional/wallet_import_rescan.py
📚 Learning: 2025-09-09T21:36:58.969Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:223-232
Timestamp: 2025-09-09T21:36:58.969Z
Learning: In RawSender class (src/stats/rawsender.cpp), socket access operations (m_sock and m_server) should be protected by the cs_net mutex, not avoiding synchronization entirely. While lock overhead concerns are valid in general, socket operations require proper synchronization via cs_net.
Applied to files:
src/netbase.cpp
📚 Learning: 2025-05-10T00:54:15.597Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6629
File: src/evo/deterministicmns.cpp:473-485
Timestamp: 2025-05-10T00:54:15.597Z
Learning: In the current implementation of `NetInfoEntry`, only `CService` is a valid type and `std::monostate` represents an invalid state. Entries that don't provide a valid `CService` through `GetAddrPort()` should be rejected with an exception, not silently skipped.
Applied to files:
src/netbase.cpp
📚 Learning: 2025-09-09T21:36:11.833Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:0-0
Timestamp: 2025-09-09T21:36:11.833Z
Learning: In RawSender class (src/stats/rawsender.cpp), cs_net is the appropriate mutex for protecting socket access (m_sock) and network operations, not additional custom locks. The implementation correctly uses cs_net with GUARDED_BY annotations and EXCLUSIVE_LOCKS_REQUIRED to synchronize socket access between SendDirectly() and ReconnectThread().
Applied to files:
src/netbase.cpp
🧬 Code graph analysis (8)
test/functional/wallet_balance.py (2)
src/wallet/rpc/backup.cpp (7)
descriptors(2029-2029)dumpprivkey(831-875)dumpprivkey(831-831)importaddress(207-308)importaddress(207-207)importprivkey(87-179)importprivkey(87-87)test/functional/test_framework/util.py (1)
assert_equal(69-74)
test/functional/wallet_importdescriptors.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
src/wallet/wallet.cpp (6)
src/node/blockstorage.cpp (2)
WITH_LOCK(518-518)WITH_LOCK(773-773)src/rpc/quorums.cpp (2)
WITH_LOCK(138-138)WITH_LOCK(1011-1011)src/rpc/rawtransaction.cpp (1)
WITH_LOCK(651-651)src/net_processing.cpp (3)
WITH_LOCK(331-334)WITH_LOCK(3168-3168)WITH_LOCK(3190-3190)src/qt/clientmodel.cpp (1)
WITH_LOCK(175-175)src/wallet/wallet.h (1)
cs_wallet(592-592)
src/rpc/rawtransaction_util.cpp (1)
src/rpc/request.cpp (2)
JSONRPCError(56-62)JSONRPCError(56-56)
test/functional/rpc_wipewallettxes.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
src/rpc/blockchain.cpp (3)
src/test/script_tests.cpp (1)
script(286-286)src/wallet/interfaces.cpp (4)
script(190-197)script(190-190)script(206-210)script(206-206)src/script/descriptor.cpp (2)
scripts(758-763)scripts(758-758)
test/functional/wallet_import_rescan.py (2)
test/functional/test_framework/util.py (1)
assert_equal(69-74)test/functional/test_framework/test_framework.py (2)
start_nodes(660-678)sync_mempools(848-874)
src/univalue/include/univalue.h (1)
src/univalue/lib/univalue.cpp (12)
push_back(104-109)push_back(104-104)push_backV(111-116)push_backV(111-111)__pushKV(118-124)__pushKV(118-118)key(188-198)key(188-188)pushKV(126-135)pushKV(126-126)pushKVs(137-144)pushKVs(137-137)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: linux64_ubsan-build / Build source
- GitHub Check: linux64_sqlite-build / Build source
- GitHub Check: linux64-build / Build source
- GitHub Check: linux64_fuzz-build / Build source
- GitHub Check: linux64_nowallet-build / Build source
- GitHub Check: mac-build / Build source
- GitHub Check: linux64_tsan-build / Build source
- GitHub Check: arm-linux-build / Build source
- GitHub Check: win64-build / Build source
- GitHub Check: Lint / Run linters
🔇 Additional comments (58)
src/util/threadinterrupt.h (1)
9-9: LGTM!The include addition is well-placed and necessary to support the thread-safety annotations already in use throughout the file (e.g.,
EXCLUSIVE_LOCKS_REQUIREDon lines 26 and 28). This aligns with the PR's static analysis enhancements objective.src/wallet/scriptpubkeyman.cpp (1)
1929-1929: LGTM! Efficient iteration with const reference.This change eliminates unnecessary copies during iteration by using
const auto&instead ofauto. The semantic behavior is unchanged sincekey_pairis only read within the loop body.src/test/fuzz/txorphan.cpp (1)
71-71: LGTM! Typo correction improves readability.The comment typo fix from "poped" to "popped" is correct and improves code quality.
src/coins.cpp (1)
359-359: LGTM! Performance optimization eliminates unnecessary copies.The change from by-value to const-reference binding avoids copying callback function objects during iteration, which is a beneficial performance optimization with no functional impact.
src/test/util_tests.cpp (1)
1307-1321: LGTM: NOLINT suppressions are correctly applied.The inline
NOLINT(*-use-after-move)comments appropriately silence false-positive static analysis warnings. The test intentionally uses the addresses of moved-from objects (&t2,&t3) to verify that theTracker::originpointer correctly references the original object after move operations. Taking the address of a moved-from object is safe and necessary for this test's correctness validation.src/qt/splashscreen.cpp (1)
58-58: LGTM! Valid copy-elimination optimization.Binding
titleAddTextas a const reference instead of copying the QString avoids an unnecessary allocation. All uses (lines 112, 116, 123) are read-only, and the lifetime is correctly scoped to the constructor where all references occur.src/node/blockstorage.cpp (1)
451-451: Need to verify if this matches upstream Bitcoin Core or if this is a backport divergence. Let me check for any upstream context:Binding temporary to const reference creates dangling reference.
The return type of
GetBlocksDirPath()isfs::path(by value), notconst fs::path&. Line 451 binds this temporary to a const lvalue reference:const fs::path& blocksdir = gArgs.GetBlocksDirPath();This creates a dangling reference—the temporary is destroyed at the statement's end, leaving
blocksdiras a dangling pointer used in the loop at line 452. All other callers in the codebase (init.cpp:1160, init.cpp:2321, validation.cpp:2841, qt/clientmodel.cpp:255) pass the result directly to functions, never binding to a reference.Fix: Remove the reference binding. Use
const fs::path blocksdir = gArgs.GetBlocksDirPath();(copy) or pass directly tofs::directory_iteratorwithout intermediate storage.⛔ Skipped due to learnings
Learnt from: knst Repo: dashpay/dash PR: 6692 File: src/llmq/blockprocessor.cpp:217-224 Timestamp: 2025-08-19T14:57:31.801Z Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.Learnt from: knst Repo: dashpay/dash PR: 6883 File: src/rpc/rawtransaction.cpp:1088-1125 Timestamp: 2025-10-13T12:37:12.357Z Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.Learnt from: knst Repo: dashpay/dash PR: 6916 File: src/univalue/include/univalue.h:81-88 Timestamp: 2025-10-25T07:08:51.918Z Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.src/netbase.cpp (1)
393-393: LGTM! Correct optimization.These changes eliminate unnecessary assignments to
recvrwhile preserving correct error handling. The variablerecvris properly initialized at line 441 and within the switch statement (lines 465-476) before being checked at line 479, so there are no stale value issues. This optimization reduces unnecessary variable assignments without affecting the SOCKS5 negotiation flow.Also applies to: 416-416, 482-482
src/script/descriptor.cpp (1)
550-550: LGTM - backport pattern matches upstream.The removal of explicit
std::move()calls in favor of direct concatenation aligns with the backport objectives. While this changes from move to copy semantics for these temporary strings, the changes are semantically correct and match the upstream Bitcoin Core modifications.Also applies to: 574-574
src/rpc/blockchain.cpp (1)
2530-2533: LGTM! Valid move optimization.The change from
const auto& scripttoCScript& scriptenables moving the script intodescriptorson line 2533, avoiding an unnecessary copy. The sequence is correct: the script is first copied intoneedles(line 2532), then moved intodescriptors(line 2533), which is safe since the moved-from element is never accessed again.src/wallet/receive.cpp (1)
431-431: LGTM: Valid const-reference optimization.The loop iterator now uses a const reference to avoid copying
std::set<CTxDestination>objects during iteration. This is a standard performance optimization with no behavioral changes.src/logging.cpp (1)
465-465: LGTM: Efficient const-reference binding.Binding the result of
ThreadGetInternalName()to a const reference avoids an unnecessary string copy. The temporary's lifetime is extended to the scope of the reference, making this safe.src/util/string.cpp (1)
13-13: LGTM: Correct removal of ineffective std::move.Removing
std::move(search)is correct sincesearchis aconst std::string¶meter. Moving from a const reference is ineffective, so the previous code was misleading. This change improves code clarity.ci/dash/lint-tidy.sh (1)
47-47: LGTM: Administrative linting update.Adding
src/util/string.cppto the IWYU check list is appropriate given the changes to that file in this PR.src/wallet/spend.cpp (1)
316-316: LGTM: Optimization to enable move semantics.Changing the loop variable to a non-const reference allows moving
coinobjects at line 320 (std::move(coin)) instead of copying them. SinceAvailableCoinsListUnspent(wallet).all()returns a temporary vector, iterating with non-const references and moving the elements is a valid optimization.src/wallet/bdb.cpp (1)
446-446: LGTM: Const-reference optimization for map iteration.Using a const reference when iterating over
m_databasesavoids copying map entries. This is a standard performance optimization with no behavioral changes.src/bitcoin-cli.cpp (1)
951-951: LGTM: Const-reference binding avoids string copy.Binding
wallet_nameas a const reference to the result ofwallet.get_str()avoids an unnecessary string copy. Both uses ofwallet_name(lines 952 and 954) are within the same scope, making this optimization safe.src/blockfilter.cpp (1)
173-173: LGTM: Const-reference optimization for map iteration.Using a const reference when iterating over
g_filter_typesavoids copying map entries. This is a standard performance optimization consistent with the broader changes in this PR.src/test/validation_block_tests.cpp (1)
185-191: Micro-copy elimination in drain loop looks goodBinding
blockasconst auto&avoids extrashared_ptrcopies; behavior unchanged.src/rpc/mining.cpp (1)
755-762: Const-ref bind of longpoll id is fineRemoves a redundant string copy; scope-limited use is safe.
src/init.cpp (1)
1436-1444: OK to bind datadir as const referenceRemoves one
fs::pathcopy; usage stays within scope; no behavior change.src/rpc/util.cpp (1)
100-108: ParseHashV copy-avoidance is fineConst-ref to the returned string is scoped and safe; logic unchanged.
src/test/miniscript_tests.cpp (1)
119-121: UDL import for miniscript tests is correctBringing
operator"" _mstinto scope is needed for the tests; good addition.src/core_read.cpp (1)
184-199: Sighash parsing: const-ref bind LGTMMinor copy elimination with no semantic change.
src/rpc/rawtransaction_util.cpp (1)
149-150: Avoid UniValue copies in ParsePrevoutsBinding
prevTxsandprevOutas const refs reduces allocations; behavior unchanged.Also applies to: 156-157
src/wallet/test/wallet_tests.cpp (3)
784-786: LGTM: rescan path counts two AddToWallet events.Expectation of 2 while queue is blocked looks correct and stable.
797-799: LGTM: stale notifications counted after unblocking.Expecting the second pair of events (total 4) after SyncWithValidationInterfaceQueue() is correct.
821-821: LGTM: immediate notification path counts once.Asserting 2 in the second scenario (no double-count) matches the intended timing.
src/.clang-tidy (1)
4-14: Tighter static analysis config looks good.Enabling performance/bugprone checks and gating as errors is fine; expect some churn in first run.
Please confirm lint CI passes after this change on all supported compilers.Also applies to: 15-26, 27-29
src/test/base58_tests.cpp (1)
27-27: Bind JSON test elements by const reference.Nice micro-optimization; keeps semantics intact.
Also applies to: 49-49
src/test/script_tests.cpp (1)
884-884: Const-ref bind for test element — good.Avoids UniValue copies; no logic changes.
src/bitcoin-tx.cpp (1)
558-606: Const-ref prevOut in sign loop — correct and efficient.No behavior change; keeps validations identical while avoiding copies.
src/test/blockfilter_tests.cpp (1)
147-147: Const-ref bind for test entry.Removes needless UniValue copies; fine.
src/test/sighash_tests.cpp (1)
165-165: Const-ref bind for sighash JSON test entry.Good small cleanup; keeps behavior identical.
src/test/key_io_tests.cpp (1)
31-31: LGTM! Efficient const-reference bindings eliminate unnecessary copies.The conversion from by-value to const-reference for test loop variables is a clean performance optimization that avoids copying UniValue objects while preserving read-only access semantics.
Also applies to: 89-89, 129-129
src/test/transaction_tests.cpp (2)
156-156: LGTM! Efficient const-reference bindings for test variables.The conversion avoids unnecessary UniValue copies while maintaining read-only access within the test loops.
Also applies to: 240-240
175-175: LGTM! Safe const-reference binding to get_array() result.Binding a const reference to the result of
get_array()is safe here—either it aliases an existing reference (ifget_array()returns by reference) or extends the lifetime of a temporary (if it returns by value). Usage is read-only within the loop scope.Also applies to: 259-259
src/univalue/lib/univalue.cpp (4)
104-109: LGTM! Move-semantics optimization for push_back.The signature change to pass
UniValueby value enables move semantics: callers passing rvalues incur no copy, while lvalues are copied into the parameter, then the parameter is moved into storage. This is more efficient than the previous const-reference approach which always copied.
118-124: LGTM! Move-semantics optimization for __pushKV.Both key and value parameters are now passed by value and moved into internal storage, enabling efficient handling of rvalue arguments while maintaining correctness for lvalues.
126-135: LGTM! Move-semantics optimization for pushKV with correct conditional logic.The method correctly handles key replacement (line 132) and new key insertion (line 134) using move semantics. When replacing an existing key's value, the new value is moved into place; when inserting a new key-value pair, both are moved to
__pushKV.
137-144: LGTM! Move-semantics optimization for pushKVs.The parameter is passed by value and its keys/values are moved into the target object within the loop. This efficiently transfers ownership from the source object.
src/univalue/include/univalue.h (1)
80-80: ✓ Public API move semantics implementation verified and correct.The method signatures at lines 80 and 85–87 have been properly updated from const-reference to by-value parameters. The implementation (univalue.cpp line 104) correctly uses
std::move(val)to forward the parameter, enabling move semantics optimization for rvalues while maintaining backward compatibility for lvalues through implicit copy.The extensive call sites throughout the codebase (700+ occurrences) all work correctly with the new signatures. This is a standard C++11 optimization pattern with no breaking changes.
test/functional/rpc_wipewallettxes.py (1)
36-37: Test change correctly implements mempool-aware rescan behavior from Bitcoin Core bitcoin#25351 backport.The assertion change from 103 to 104 reflects the upstream Bitcoin Core bitcoin#25351 backport which implements "Rescan mempool for transactions as well." After
wipewallettxes(True)removes the unconfirmed transaction from the wallet,rescanblockchain()now recovers it from the mempool, correctly resulting in 104 transactions instead of 103. This change matches the exact modifications in the upstream backport commit.test/functional/wallet_balance.py (1)
283-305: LGTM: Mempool-aware import test correctly validates new behavior.The test appropriately verifies that mempool transactions are recognized during import operations:
- After
importaddress, the mempool transaction appears inwatchonly.untrusted_pending- After
importprivkey, the transaction moves tomine.untrusted_pendingThe conditional check at lines 298-299 with the explanatory comment is acceptable for this backport.
src/wallet/wallet.cpp (2)
1688-1689: LGTM: Documentation accurately describes mempool scanning behavior.The updated documentation clearly states that mempool will be scanned when
max_heightis not set, which aligns with the implementation.
1810-1813: LGTM: Mempool scanning implementation is correct and thread-safe.The implementation correctly:
- Scans mempool only when
max_heightis not set (full rescan scenario)- Uses
WITH_LOCK(cs_wallet, ...)for thread safety, consistent with patterns seen elsewhere in the codebase- Executes after block scanning completes, ensuring proper ordering
test/functional/wallet_importdescriptors.py (2)
430-431: LGTM: Transaction ID now captured for mempool verification.Storing
send_txidenables the subsequent assertions at lines 458-459 to verify mempool transaction visibility after descriptor import.
457-459: Rewritten Review Comment: Remove incorrect explanation of address derivationThe assertions at lines 457-459 correctly verify that mempool transactions are recognized after importing descriptors to a watch-only wallet:
- The transaction from
wmulti_privexists in the mempool- The transaction is correctly included in
wmulti_pub.listunspent(0)(unconfirmed outputs)However, the change address at line 457 (
'8y2sLiPQnB81bAeiRvwbjozJXnCCNH2nHb') is different from line 426 ('91WxMwg2NHD1PwHChhbAkeCN6nQ8ikdLEx') becausewmulti_privandwmulti_pubare separate wallets with different key material (private vs. public keys). The address sequencing reflects normal index advancement (0 consumed, 1 pending, 2 available), not a mempool-triggered update. Line 456's comment should clarify this derives from the internal (change) descriptor path 84h/1h/0h/*, and the keypool assertion at line 460 confirms correct index consumption.src/wallet/rpc/backup.cpp (6)
94-101: Consistent rescan guidance for importprivkeyThe added explanation about when
rescancan be safely set tofalse, plus the updated argument description (“Scan the chain and mempool for wallet transactions.”), is clear and aligns with mempool-aware rescans. No issues.
213-214: importaddress help text matches new rescan semanticsThe extra note about using
rescanwalletwhenrescan=falseand the mempool-inclusive wording for therescanargument look consistent withimportprivkeyand the broader behavior change.Also applies to: 223-223
411-412: importpubkey rescan docs kept in syncSame pattern here: guidance for
rescan=falseand the “chain and mempool” description are consistent with the other RPCs. Good to keep these three imports aligned.Also applies to: 417-417
493-493: importwallet: explicit blockchain + mempool rescan noteThe new sentence about rescanning both blockchain and mempool and pointing users to
getwalletinfofor progress is helpful and matches the intended behavior of the post-import rescan.
1484-1485: importmulti: clearer rescan option textThe additional explanation around
rescan=falseand the updatedoptions.rescandescription (“Scan the chain and mempool… after all imports.”) are accurate and consistent with the other RPCs.Also applies to: 1529-1529
1841-1841: importdescriptors timestamp help mentions mempoolThe timestamp help now explicitly says that blocks up to 2 hours before the earliest timestamp and the mempool are scanned, which matches the mempool-rescan behavior under test.
test/functional/wallet_import_rescan.py (4)
72-104: Variant.check: dynamic confirmations and “trusted” field assertionsThe updated
checkmethod correctly derives confirmations from the node’s current height and an optionalconfirmation_height, while using0for mempool transactions when no height is passed. Matching the address entry’sconfirmationsto the tx, and asserting that confirmed txs lack a"trusted"field, is consistent with the new wallet RPC semantics and supports the mempool-rescan tests.
162-165: setup_network: add whitelist for second startupRestarting all nodes with
[email protected]ensures mempool synchronization and P2P behavior are not limited by bans/DoS scoring during the import/rescan checks. This is a targeted change and still respects the per-node prune/txindex configuration established inadd_nodes.
205-210: Loop simplification when sending second-round transactionsSwitching to
for variant in IMPORT_VARIANTS:(dropping the unused index) preserves behavior while slightly simplifying the code. No functional impact.
221-258: New mempool-rescan coverage path looks correctThe added mempool-specific test section:
- Filters out late-timestamp and pruned variants, focusing on unpruned nodes where mempool rescans are meaningful.
- Keeps the block timestamp fixed so only mempool contents change.
- Creates one unconfirmed transaction per variant, syncs mempools, and then reuses the existing
Variantimport logic andcheck()to assert:
rescan=trueimports see the mempool transaction withconfirmations==0and the expected balance and tx count.rescan=falseimports see no txs and zero balance.Node selection via
ImportNode(variant.prune, expect_rescan)matches the earlier parts of the test, and labels are distinct (“mempool label …”), so per-label assertions remain isolated even though nodes are reused. This gives good coverage of mempool-inclusive rescan behavior without altering non-mempool cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (48)
ci/dash/lint-tidy.sh(1 hunks)src/.clang-tidy(1 hunks)src/bench/wallet_loading.cpp(0 hunks)src/bitcoin-cli.cpp(1 hunks)src/bitcoin-tx.cpp(1 hunks)src/blockfilter.cpp(1 hunks)src/coins.cpp(1 hunks)src/core_read.cpp(1 hunks)src/init.cpp(1 hunks)src/logging.cpp(1 hunks)src/netbase.cpp(3 hunks)src/node/blockstorage.cpp(1 hunks)src/qt/splashscreen.cpp(1 hunks)src/rpc/blockchain.cpp(1 hunks)src/rpc/mining.cpp(1 hunks)src/rpc/output_script.cpp(0 hunks)src/rpc/rawtransaction_util.cpp(1 hunks)src/rpc/util.cpp(1 hunks)src/script/descriptor.cpp(2 hunks)src/test/base58_tests.cpp(2 hunks)src/test/blockfilter_tests.cpp(1 hunks)src/test/fuzz/txorphan.cpp(1 hunks)src/test/key_io_tests.cpp(3 hunks)src/test/miniscript_tests.cpp(1 hunks)src/test/script_tests.cpp(1 hunks)src/test/sighash_tests.cpp(1 hunks)src/test/transaction_tests.cpp(4 hunks)src/test/util_tests.cpp(1 hunks)src/test/validation_block_tests.cpp(1 hunks)src/univalue/include/univalue.h(1 hunks)src/univalue/lib/univalue.cpp(2 hunks)src/util/message.cpp(0 hunks)src/util/strencodings.cpp(0 hunks)src/util/string.cpp(1 hunks)src/util/string.h(0 hunks)src/util/threadinterrupt.h(1 hunks)src/wallet/bdb.cpp(1 hunks)src/wallet/receive.cpp(1 hunks)src/wallet/rpc/backup.cpp(8 hunks)src/wallet/scriptpubkeyman.cpp(1 hunks)src/wallet/spend.cpp(1 hunks)src/wallet/test/wallet_tests.cpp(3 hunks)src/wallet/wallet.cpp(2 hunks)src/wallet/walletdb.cpp(2 hunks)test/functional/rpc_wipewallettxes.py(1 hunks)test/functional/wallet_balance.py(1 hunks)test/functional/wallet_import_rescan.py(5 hunks)test/functional/wallet_importdescriptors.py(2 hunks)
💤 Files with no reviewable changes (5)
- src/util/strencodings.cpp
- src/bench/wallet_loading.cpp
- src/util/message.cpp
- src/util/string.h
- src/rpc/output_script.cpp
✅ Files skipped from review due to trivial changes (1)
- src/wallet/wallet.cpp
🚧 Files skipped from review as they are similar to previous changes (21)
- src/test/blockfilter_tests.cpp
- src/util/string.cpp
- src/test/base58_tests.cpp
- src/test/sighash_tests.cpp
- src/test/transaction_tests.cpp
- src/coins.cpp
- src/core_read.cpp
- src/wallet/scriptpubkeyman.cpp
- src/node/blockstorage.cpp
- ci/dash/lint-tidy.sh
- src/wallet/receive.cpp
- src/.clang-tidy
- src/test/util_tests.cpp
- src/univalue/include/univalue.h
- src/init.cpp
- src/test/validation_block_tests.cpp
- src/wallet/spend.cpp
- src/bitcoin-tx.cpp
- src/test/fuzz/txorphan.cpp
- src/rpc/util.cpp
- src/logging.cpp
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Learnt from: kwvg
Repo: dashpay/dash PR: 6838
File: src/governance/signing.cpp:84-85
Timestamp: 2025-10-03T11:29:36.358Z
Learning: After bitcoin#25153 (included in dash#6775), UniValue uses the templated getInt<T>() API instead of the legacy get_int() and get_int64() methods. For example, use jproposal["start_epoch"].getInt<int64_t>() to retrieve int64_t values from UniValue objects.
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/rpc/rawtransaction_util.cppsrc/rpc/mining.cppsrc/wallet/walletdb.cppsrc/wallet/test/wallet_tests.cpptest/functional/wallet_importdescriptors.pysrc/univalue/lib/univalue.cppsrc/wallet/rpc/backup.cpptest/functional/rpc_wipewallettxes.pysrc/bitcoin-cli.cppsrc/test/script_tests.cpp
📚 Learning: 2025-10-25T07:08:51.918Z
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Applied to files:
src/rpc/rawtransaction_util.cppsrc/univalue/lib/univalue.cpp
📚 Learning: 2025-06-20T23:32:16.225Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6726
File: test/functional/rpc_createmultisig.py:120-120
Timestamp: 2025-06-20T23:32:16.225Z
Learning: In the rpc_createmultisig.py test, the checkbalances() function correctly excludes 9 blocks from the balance calculation: 8 blocks from do_multisig() calls (2 blocks per call × 4 calls) plus 1 block from checkbalances() itself.
Applied to files:
test/functional/wallet_balance.pytest/functional/wallet_importdescriptors.py
📚 Learning: 2025-02-14T15:19:17.218Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Applied to files:
src/wallet/walletdb.cppsrc/wallet/test/wallet_tests.cppsrc/bitcoin-cli.cpp
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
src/wallet/test/wallet_tests.cpptest/functional/wallet_import_rescan.pytest/functional/rpc_wipewallettxes.py
📚 Learning: 2025-09-09T21:36:58.969Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:223-232
Timestamp: 2025-09-09T21:36:58.969Z
Learning: In RawSender class (src/stats/rawsender.cpp), socket access operations (m_sock and m_server) should be protected by the cs_net mutex, not avoiding synchronization entirely. While lock overhead concerns are valid in general, socket operations require proper synchronization via cs_net.
Applied to files:
src/netbase.cpp
📚 Learning: 2025-09-09T21:36:11.833Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:0-0
Timestamp: 2025-09-09T21:36:11.833Z
Learning: In RawSender class (src/stats/rawsender.cpp), cs_net is the appropriate mutex for protecting socket access (m_sock) and network operations, not additional custom locks. The implementation correctly uses cs_net with GUARDED_BY annotations and EXCLUSIVE_LOCKS_REQUIRED to synchronize socket access between SendDirectly() and ReconnectThread().
Applied to files:
src/netbase.cpp
📚 Learning: 2025-08-10T13:52:46.289Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6666
File: test/functional/rpc_netinfo.py:73-81
Timestamp: 2025-08-10T13:52:46.289Z
Learning: In the Bitcoin/Dash test framework, `self.node.extra_args` contains the original startup arguments for a TestNode and is not modified by `test.restart_node()`. Each restart with new `extra_args` doesn't update the stored `self.node.extra_args`, so copying from it always provides a clean slate without accumulated modifications from previous restarts.
Applied to files:
test/functional/wallet_import_rescan.py
🧬 Code graph analysis (4)
test/functional/wallet_balance.py (2)
src/wallet/rpc/backup.cpp (7)
descriptors(2029-2029)dumpprivkey(831-875)dumpprivkey(831-831)importaddress(207-308)importaddress(207-207)importprivkey(87-179)importprivkey(87-87)test/functional/test_framework/util.py (1)
assert_equal(69-74)
test/functional/wallet_importdescriptors.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
test/functional/wallet_import_rescan.py (2)
test/functional/test_framework/util.py (1)
assert_equal(69-74)test/functional/test_framework/test_framework.py (2)
start_nodes(660-678)sync_mempools(848-874)
test/functional/rpc_wipewallettxes.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: linux64_tsan-build / Build source
- GitHub Check: linux64_nowallet-build / Build source
- GitHub Check: mac-build / Build source
- GitHub Check: arm-linux-build / Build source
- GitHub Check: linux64_sqlite-build / Build source
- GitHub Check: linux64_ubsan-build / Build source
- GitHub Check: linux64_fuzz-build / Build source
- GitHub Check: linux64-build / Build source
- GitHub Check: win64-build / Build source
- GitHub Check: Lint / Run linters
🔇 Additional comments (36)
src/util/threadinterrupt.h (1)
9-9: LGTM! Proper include for thread safety annotations.Adding
#include <threadsafety.h>is correct since the file usesEXCLUSIVE_LOCKS_REQUIREDannotations on lines 26 and 28. This follows the "include what you use" principle and makes the header self-contained.src/test/script_tests.cpp (1)
884-884: LGTM! Avoids unnecessary copy.The change from by-value to const-reference binding eliminates an unnecessary copy of the UniValue object while preserving correctness. Since
testis only read (never modified), binding to a const reference is safe and improves efficiency.src/test/key_io_tests.cpp (1)
31-31: LGTM! Consistent copy elimination across all test cases.All three changes consistently eliminate unnecessary copies by binding to const references. Each
testvariable is only read (never modified), making the const-reference binding both safe and more efficient.Also applies to: 89-89, 129-129
src/test/miniscript_tests.cpp (1)
119-121: LGTM! Proper handling of clang-tidy false positive.The addition of the using declaration for the
_mstliteral operator (used on line 145) is correct, and the NOLINTNEXTLINE directive appropriately suppresses a known clang-tidy false positive documented in the referenced LLVM issue.test/functional/rpc_wipewallettxes.py (1)
36-37: LGTM! Test correctly verifies mempool-inclusive rescan behavior.The updated assertion correctly reflects the backported behavior change where
rescanblockchain()(when called withoutmax_height) now includes mempool transactions. After wiping the unconfirmed transaction at line 33, the rescan properly recovers it from the mempool, bringing the total from 103 to 104 transactions.src/wallet/rpc/backup.cpp (3)
94-95: LGTM: Consistent help text improvements across import RPCs.The help text updates consistently enhance user guidance by:
- Clarifying that rescanning includes both chain and mempool
- Explaining when
rescan=falseis appropriate (key never used)- Noting that
rescanwalletshould be called if the key was used butrescan=falsewas setThese documentation improvements are consistent across
importprivkey,importaddress, andimportpubkeyRPCs.Also applies to: 100-100, 213-214, 223-223, 411-412, 417-417
493-493: LGTM: Clear documentation of rescan behavior.The updated help text clearly indicates that both the blockchain and mempool will be rescanned after a successful import, improving user understanding of the operation's scope.
1484-1485: LGTM: Completed documentation updates for descriptor imports.The help text updates for
importmultiandimportdescriptorscomplete the consistent documentation improvements across all import-related RPCs. The changes appropriately indicate that rescanning includes mempool transactions in addition to blockchain transactions.Also applies to: 1529-1529, 1841-1841
src/script/descriptor.cpp (2)
550-550: LGTM!The concatenation logic is correct. The change from move semantics to direct concatenation is intentional from the upstream backport and doesn't introduce any functional issues.
574-574: LGTM!The concatenation logic is correct and consistent with the change at line 550. The modification is part of the upstream backport and maintains correct functionality.
src/qt/splashscreen.cpp (1)
58-58: LGTM – const reference binding is safe here.The change from by-value to const reference avoids a copy. Since all uses of
titleAddText(lines 112, 116, 123) occur within the constructor scope, temporary lifetime extension ensures the binding remains valid throughout its usage.src/netbase.cpp (1)
393-393: LGTM! Clean refactoring of error handling.The changes eliminate unnecessary assignments to
recvrwhen the return value is only needed for an immediate comparison. The variable is still properly used for the more complex error handling in the middle section (lines 441-479) where the specific error type matters. This simplifies the code without changing behavior.Also applies to: 416-416, 482-482
src/rpc/blockchain.cpp (1)
2530-2533: LGTM! Performance optimization through move semantics.The change from
const auto& scripttoCScript& scriptenables the move operation on line 2533, reducing overhead. The implementation is correct:
- Line 2531: Script is used (read-only) to infer the descriptor
- Line 2532: Script is copied into the
needlesset- Line 2533: Script is moved into
descriptorsmap as the keyThis optimizes from two copies to one copy + one move, while maintaining correctness since the script isn't accessed after the move.
test/functional/wallet_importdescriptors.py (1)
430-431: LGTM! Captures transaction ID for subsequent validation.The change from discarding the return value to capturing
send_txidenables the assertions below to verify mempool and unspent output state, which aligns with the mempool-rescan feature being tested.test/functional/wallet_import_rescan.py (6)
79-79: LGTM! Minor formatting adjustment.Blank line removed for consistency.
91-98: LGTM! Correctly handles mempool transactions with dynamic confirmations.The updated logic computes
confirmationsdynamically based on whetherconfirmation_heightis provided. Whenconfirmation_heightisNone(mempool transactions), confirmations correctly evaluates to 0. The assertion on line 97 ensures that confirmed transactions don't have a "trusted" field, which is the expected behavior.
102-102: LGTM! Reuses the computed confirmations value.This ensures consistency between transaction and address confirmation checks.
161-161: LGTM! Whitelist flag accelerates test execution.The whitelist flag speeds up transaction relay and mempool synchronization, which is beneficial for the mempool-rescan tests added below.
166-166: LGTM! Minor formatting adjustment.Blank line removed for consistency.
220-257: LGTM! Comprehensive mempool rescan test coverage.The new test section properly validates mempool-inclusive rescan behavior:
- Filters out
late_timestampandprunedvariants that aren't applicable to mempool testing- Creates mempool transactions with unique amounts for each import variant
- Verifies mempool size matches expectations and synchronizes across nodes
- For each variant, validates that:
- Imports with
rescan=yescorrectly pick up mempool transactions- Imports with
rescan=nocorrectly ignore mempool transactionsThe test design aligns with the PR objective of validating wallet rescanning that includes mempool when no max_height is specified.
test/functional/wallet_balance.py (1)
283-305: LGTM! Validates mempool-inclusive import behavior for legacy wallets.The new test block correctly validates that:
- importaddress flow: After importing an address to a fresh wallet, the mempool transaction appears in
watchonly.untrusted_pending(line 293)- importprivkey flow: After importing the private key, the balance moves from
watchonlytomine.untrusted_pending(lines 294-299)- Fresh wallet importprivkey flow: A new wallet with importprivkey directly sees the balance in
mine.untrusted_pending(lines 302-304)The conditional check on line 298 handles Dash-specific behavior where
watchonlyis omitted when the balance is zero, as noted in the TODO comment on line 297. This divergence from Bitcoin Core is documented and intentional.src/wallet/bdb.cpp (1)
438-448: Const-ref iteration overm_databasesis correct and avoids copiesUsing
for (const auto& it : m_databases)here is safe and slightly more efficient since you only readit.firstto buildfilenames, without changing any behavior.src/blockfilter.cpp (1)
171-176: Efficient iteration inAllBlockFilterTypesSwitching to
for (const auto& entry : g_filter_types)is a straightforward copy-elision that leaves the logic and thread-safety of thestd::call_onceinitialization unchanged.src/rpc/mining.cpp (1)
755-762: Longpolllpstrconst-ref binding is safe
lpstris a const reference to the temporary returned bylpval.get_str(), and it’s only used within the same block, so lifetime extension keeps it valid while needed; behavior matches the previous by-value code while avoiding an extra copy.src/bitcoin-cli.cpp (1)
949-955: Const-refwallet_namebinding is lifetime-safe and preserves behaviorBinding
wallet_nameasconst std::string&towallet.get_str()is safe here (the temporary’s lifetime is extended to the scope of the reference) and it’s only copied into the optionalrpcwalletparameter, so this just avoids an intermediate string copy with no semantic change.src/rpc/rawtransaction_util.cpp (1)
148-178: Const-ref bindings inParsePrevoutsare safe and reduce copiesUsing
const UniValue& prevTxs = prevTxsUnival.get_array();andconst UniValue& prevOut = p.get_obj();is safe here—each temporary’s lifetime is extended to the reference scope, and the values are only read within that scope—so behavior is unchanged while avoiding a couple of UniValue copies.src/wallet/test/wallet_tests.cpp (3)
784-785: LGTM! Helpful clarifying comment.The comment clearly explains that the two AddToWallet events correspond to block_tx and mempool_tx detected during the wallet rescan, despite notifications being blocked.
797-799: LGTM! Clear explanation of event replay.The comment correctly describes that the AddToWallet count increases to 4 because the queued notifications are now processed, causing the same transactions to trigger AddToWallet events a second time.
821-821: Correct expectation adjustment for synchronous notification scenario.The change from 4 to 2 is correct here because in this test path, transactions are created and notifications are processed synchronously (via SyncWithValidationInterfaceQueue on Line 818) rather than being queued and replayed. This results in only 2 AddToWallet events instead of 4.
src/wallet/walletdb.cpp (3)
887-891: LGTM! Efficient iteration with const reference.Using
const auto&instead ofautoavoids unnecessary copies of descriptor cache entries during iteration, improving performance without changing behavior.
894-902: LGTM! Optimized descriptor key iteration.The change to
const auto&eliminates unnecessary copies of descriptor key pairs, which improves wallet loading performance since these are non-trivial objects.
904-912: LGTM! Consistent optimization for encrypted keys.Using
const auto&here maintains consistency with the other iterator optimizations and avoids copying crypted key data during wallet loading.src/univalue/lib/univalue.cpp (4)
104-109: LGTM! Modern C++ move semantics optimization.The change from pass-by-const-reference to pass-by-value with std::move enables efficient handling of both lvalues (copy once) and rvalues (move directly), improving performance when pushing temporary UniValue objects.
118-124: LGTM! Consistent move optimization for key-value pairs.Both parameters now use pass-by-value with std::move, allowing efficient handling of temporary keys and values. This is consistent with the push_back optimization and follows modern C++ best practices.
126-135: LGTM! Proper move semantics in both code paths.The function correctly uses std::move when replacing an existing value (Line 132) and when delegating to __pushKV for new keys (Line 134), ensuring efficient handling in both scenarios.
137-144: LGTM! Efficient object merging with move semantics.Pass-by-value with std::move in the loop enables efficient transfer of key-value pairs when merging objects, particularly beneficial when the source object is a temporary.
| assert_equal(change_addr, '8y2sLiPQnB81bAeiRvwbjozJXnCCNH2nHb') | ||
| assert(send_txid in self.nodes[0].getrawmempool(True)) | ||
| assert(send_txid in (x['txid'] for x in wmulti_pub.listunspent(0))) | ||
| assert_equal(wmulti_pub.getwalletinfo()['keypoolsize'], 999) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Use test framework assertion helpers consistently.
Lines 458-459 use bare assert statements instead of the test framework's assert_equal or related helpers. The test framework provides better error messages and is the established pattern throughout the codebase.
Apply this diff to use framework assertions:
assert_equal(change_addr, '8y2sLiPQnB81bAeiRvwbjozJXnCCNH2nHb')
- assert(send_txid in self.nodes[0].getrawmempool(True))
- assert(send_txid in (x['txid'] for x in wmulti_pub.listunspent(0)))
+ assert send_txid in self.nodes[0].getrawmempool(True)
+ assert send_txid in (x['txid'] for x in wmulti_pub.listunspent(0))
assert_equal(wmulti_pub.getwalletinfo()['keypoolsize'], 999)Note: Alternatively, consider using assert_equal(send_txid in self.nodes[0].getrawmempool(True), True) for consistency, though the bare assert without parentheses is acceptable in Python test code.
🤖 Prompt for AI Agents
In test/functional/wallet_importdescriptors.py around lines 457 to 460, the two
bare assert statements should be converted to test framework assertions for
consistent messages and style; replace "assert(send_txid in
self.nodes[0].getrawmempool(True))" with "assert_true(send_txid in
self.nodes[0].getrawmempool(True))" (or alternatively assert_equal(..., True))
and replace "assert(send_txid in (x['txid'] for x in
wmulti_pub.listunspent(0)))" with "assert_true(send_txid in (x['txid'] for x in
wmulti_pub.listunspent(0)))" so both checks use the framework helpers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a backported code from bitcoin core; no changes will be provided in this PR until bitcoin core changes it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knst, understood! I acknowledge your decision. This aligns with the project's established backport policy of maintaining fidelity to upstream Bitcoin Core code to minimize merge conflicts in future backports. The bare assert statements will remain as they are in the original Bitcoin Core implementation.
🧠 Learnings used
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Learnt from: kwvg
Repo: dashpay/dash PR: 6752
File: src/wallet/load.cpp:164-164
Timestamp: 2025-07-17T15:48:29.418Z
Learning: In Dash Core, kwvg prefers using assert() statements to document expected behavior in code paths, especially when the called function also has internal asserts. This is used as a defensive programming pattern rather than requiring conditional error handling.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
ab0119c to
3c4ff33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/evo/specialtxman.cpp (1)
489-489: Restore std::move for better performance.The assignment copies the entire
newListinstead of moving it. SincenewListis a local variable that's no longer used after this line, usingstd::movewould avoid the copy overhead and improve performance.Apply this diff to restore move semantics:
- mnListRet = newList; + mnListRet = std::move(newList);Note: If this change was made intentionally to match upstream Bitcoin Core's implementation for backport consistency, please disregard this suggestion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (60)
-
ci/dash/lint-tidy.sh(1 hunks) -
src/.clang-tidy(1 hunks) -
src/bench/load_external.cpp(1 hunks) -
src/bench/wallet_loading.cpp(0 hunks) -
src/bitcoin-cli.cpp(1 hunks) -
src/bitcoin-tx.cpp(1 hunks) -
src/blockfilter.cpp(1 hunks) -
src/bls/bls_worker.cpp(1 hunks) -
src/coins.cpp(1 hunks) -
src/core_read.cpp(1 hunks) -
src/evo/creditpool.cpp(1 hunks) -
src/evo/mnauth.cpp(1 hunks) -
src/evo/specialtxman.cpp(1 hunks) -
src/init.cpp(1 hunks) -
src/instantsend/instantsend.cpp(1 hunks) -
src/llmq/blockprocessor.cpp(1 hunks) -
src/llmq/snapshot.cpp(1 hunks) -
src/logging.cpp(1 hunks) -
src/masternode/meta.cpp(1 hunks) -
src/netbase.cpp(3 hunks) -
src/node/blockstorage.cpp(1 hunks) -
src/qt/governancelist.cpp(1 hunks) -
src/qt/splashscreen.cpp(2 hunks) -
src/qt/transactionrecord.cpp(0 hunks) -
src/rpc/blockchain.cpp(1 hunks) -
src/rpc/coinjoin.cpp(1 hunks) -
src/rpc/evo.cpp(0 hunks) -
src/rpc/masternode.cpp(0 hunks) -
src/rpc/mining.cpp(3 hunks) -
src/rpc/output_script.cpp(0 hunks) -
src/rpc/rawtransaction_util.cpp(1 hunks) -
src/rpc/util.cpp(3 hunks) -
src/script/descriptor.cpp(2 hunks) -
src/test/base58_tests.cpp(2 hunks) -
src/test/blockfilter_tests.cpp(1 hunks) -
src/test/coinstatsindex_tests.cpp(0 hunks) -
src/test/evo_deterministicmns_tests.cpp(1 hunks) -
src/test/evo_trivialvalidation.cpp(1 hunks) -
src/test/fuzz/txorphan.cpp(1 hunks) -
src/test/key_io_tests.cpp(3 hunks) -
src/test/miniscript_tests.cpp(1 hunks) -
src/test/script_tests.cpp(1 hunks) -
src/test/sighash_tests.cpp(1 hunks) -
src/test/transaction_tests.cpp(4 hunks) -
src/test/util_tests.cpp(1 hunks) -
src/test/validation_block_tests.cpp(1 hunks) -
src/univalue/include/univalue.h(1 hunks) -
src/univalue/lib/univalue.cpp(2 hunks) -
src/util/message.cpp(0 hunks) -
src/util/strencodings.cpp(0 hunks) -
src/util/string.cpp(1 hunks) -
src/util/string.h(0 hunks) -
src/util/threadinterrupt.h(1 hunks) -
src/wallet/bdb.cpp(1 hunks) -
src/wallet/receive.cpp(1 hunks) -
src/wallet/scriptpubkeyman.cpp(1 hunks) -
src/wallet/spend.cpp(1 hunks) -
src/wallet/test/bip39_tests.cpp(1 hunks) -
src/wallet/test/wallet_tests.cpp(3 hunks) -
src/wallet/walletdb.cpp(2 hunks)
💤 Files with no reviewable changes (9)
- src/rpc/output_script.cpp
- src/rpc/masternode.cpp
- src/util/strencodings.cpp
- src/rpc/evo.cpp
- src/bench/wallet_loading.cpp
- src/test/coinstatsindex_tests.cpp
- src/util/message.cpp
- src/qt/transactionrecord.cpp
- src/util/string.h
🚧 Files skipped from review as they are similar to previous changes (26)
- src/init.cpp
- src/test/util_tests.cpp
- src/node/blockstorage.cpp
- src/.clang-tidy
- src/wallet/bdb.cpp
- src/wallet/test/bip39_tests.cpp
- src/test/blockfilter_tests.cpp
- src/llmq/blockprocessor.cpp
- src/qt/governancelist.cpp
- src/blockfilter.cpp
- src/test/base58_tests.cpp
- src/test/script_tests.cpp
- src/core_read.cpp
- src/rpc/mining.cpp
- src/test/sighash_tests.cpp
- src/test/transaction_tests.cpp
- src/wallet/spend.cpp
- src/instantsend/instantsend.cpp
- src/wallet/walletdb.cpp
- src/test/evo_deterministicmns_tests.cpp
- src/masternode/meta.cpp
- src/bitcoin-tx.cpp
- src/rpc/blockchain.cpp
- src/test/key_io_tests.cpp
- src/evo/creditpool.cpp
- src/rpc/coinjoin.cpp
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
📚 Learning: 2025-02-14T15:19:17.218Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Applied to files:
src/bitcoin-cli.cppsrc/wallet/test/wallet_tests.cpp
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/bitcoin-cli.cppsrc/rpc/rawtransaction_util.cppsrc/wallet/test/wallet_tests.cppsrc/rpc/util.cppsrc/univalue/lib/univalue.cppsrc/univalue/include/univalue.h
📚 Learning: 2025-10-25T07:08:51.918Z
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Applied to files:
src/rpc/rawtransaction_util.cppsrc/univalue/lib/univalue.cppsrc/univalue/include/univalue.h
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
src/wallet/test/wallet_tests.cpp
📚 Learning: 2025-10-03T11:29:36.358Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6838
File: src/governance/signing.cpp:84-85
Timestamp: 2025-10-03T11:29:36.358Z
Learning: After bitcoin#25153 (included in dash#6775), UniValue uses the templated getInt<T>() API instead of the legacy get_int() and get_int64() methods. For example, use jproposal["start_epoch"].getInt<int64_t>() to retrieve int64_t values from UniValue objects.
Applied to files:
src/rpc/util.cpp
📚 Learning: 2025-08-19T14:57:31.801Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Applied to files:
src/test/validation_block_tests.cpp
📚 Learning: 2025-09-09T21:36:11.833Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:0-0
Timestamp: 2025-09-09T21:36:11.833Z
Learning: In RawSender class (src/stats/rawsender.cpp), cs_net is the appropriate mutex for protecting socket access (m_sock) and network operations, not additional custom locks. The implementation correctly uses cs_net with GUARDED_BY annotations and EXCLUSIVE_LOCKS_REQUIRED to synchronize socket access between SendDirectly() and ReconnectThread().
Applied to files:
src/netbase.cpp
📚 Learning: 2025-09-09T21:36:58.969Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:223-232
Timestamp: 2025-09-09T21:36:58.969Z
Learning: In RawSender class (src/stats/rawsender.cpp), socket access operations (m_sock and m_server) should be protected by the cs_net mutex, not avoiding synchronization entirely. While lock overhead concerns are valid in general, socket operations require proper synchronization via cs_net.
Applied to files:
src/netbase.cpp
🧬 Code graph analysis (2)
src/rpc/rawtransaction_util.cpp (1)
src/rpc/request.cpp (2)
JSONRPCError(56-62)JSONRPCError(56-56)
src/univalue/include/univalue.h (1)
src/univalue/lib/univalue.cpp (12)
push_back(104-109)push_back(104-104)push_backV(111-116)push_backV(111-111)__pushKV(118-124)__pushKV(118-118)key(188-198)key(188-188)pushKV(126-135)pushKV(126-126)pushKVs(137-144)pushKVs(137-137)
🪛 GitHub Actions: Clang Diff Format Check
src/evo/mnauth.cpp
[error] 1-999: Clang format differences found. The diff indicates formatting changes between before and after; run the clang-format-diff script or clang-format to fix formatting in this file. Command that triggered the failure: git diff -U0 origin/develop --
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: arm-linux-build / Build source
- GitHub Check: mac-build / Build source
- GitHub Check: linux64_tsan-build / Build source
- GitHub Check: linux64_nowallet-build / Build source
- GitHub Check: linux64-build / Build source
- GitHub Check: linux64_ubsan-build / Build source
- GitHub Check: linux64_fuzz-build / Build source
- GitHub Check: linux64_sqlite-build / Build source
- GitHub Check: win64-build / Build source
- GitHub Check: Lint / Run linters
🔇 Additional comments (30)
src/test/validation_block_tests.cpp (1)
185-185: LGTM! Optimizes loop iteration to avoid unnecessary copies.The change from
autotoconst auto&avoids copyingshared_ptrobjects in each iteration, which is beneficial in this hot loop executed across multiple threads. Since the loop body only reads fromblockand doesn't modify it, using a const reference is both correct and more efficient.src/test/fuzz/txorphan.cpp (1)
71-71: LGTM! Clean hygiene improvements.The spelling correction ("popped" instead of "poped") and the removal of the unused
#include <algorithm>header improve code quality without affecting functionality. The code usesstd::swapfrom<utility>(line 25), so the<algorithm>header is indeed unnecessary.src/util/threadinterrupt.h (1)
9-9: LGTM!The explicit include of
threadsafety.his appropriate since the class uses thread safety annotations (EXCLUSIVE_LOCKS_REQUIRED) on lines 26 and 28. This makes the dependency explicit rather than relying on transitive includes.src/bls/bls_worker.cpp (1)
18-18: LGTM! Efficient const-reference binding.The change from
auto itemtoconst auto& itemavoids unnecessary copies while preserving the validation and duplicate-detection logic.src/coins.cpp (1)
359-359: LGTM! Good optimization.Using
const auto&instead ofautoavoids unnecessary copies of the callback objects during iteration, which is especially beneficial if the callbacks arestd::functionor similar types that can be expensive to copy.src/test/miniscript_tests.cpp (1)
119-121: LGTM! User-defined literal operator properly declared.The using declaration brings the
_mstoperator into scope for cleaner syntax (used on line 145). The NOLINTNEXTLINE directive appropriately suppresses a false positive from clang-tidy regarding unused using declarations, with a reference to the relevant LLVM issue.src/netbase.cpp (1)
393-393: LGTM! Clean refactoring of error checking.The changes eliminate unnecessary intermediate variable assignments by comparing
InterruptibleRecvresults directly toIntrRecvError::OKwhen the specific error type doesn't need to be discriminated. The logic remains unchanged, and cases that do need to distinguish error types (like checking for Timeout at line 442) still properly store the result inrecvr.Also applies to: 416-416, 482-482
src/script/descriptor.cpp (2)
543-553: LGTM - Backport change is correct.The removal of
std::move(tmp)at line 550 is consistent with the upstream Bitcoin Core backport. While this changes the operation from move to copy, the functional behavior remains correct and the performance impact is negligible.
555-581: LGTM - Backport change is correct.The removal of
std::move(tmp)at line 574 is consistent with the upstream Bitcoin Core backport. Note that line 579 retains move semantics for the final concatenation, indicating this was a deliberate upstream change rather than a blanket removal of all moves. The code remains functionally correct.src/test/evo_trivialvalidation.cpp (1)
51-51: LGTM: Loop variable optimization reduces unnecessary copies.Changing the loop variable from by-value to const-reference avoids copying UniValue objects on each iteration while preserving the existing read-only access pattern.
src/wallet/scriptpubkeyman.cpp (1)
1929-1929: LGTM: Loop iteration optimization avoids unnecessary pair copies.Changing from by-value to const-reference iteration avoids copying each key-value pair from m_map_crypted_keys. The loop body only reads from key_pair, making const-reference the appropriate choice.
src/wallet/test/wallet_tests.cpp (2)
784-799: LGTM: Test expectations updated to reflect wallet rescan behavior changes.The updated assertions and clarifying comments correctly reflect the wallet's changed behavior regarding mempool transaction handling during rescans. The test now expects:
- 2 AddToWallet events after initial rescan (block_tx and mempool_tx detected)
- 4 total events after processing queued notifications (stale events counted again)
The comments help document the event counting logic at each checkpoint.
821-821: LGTM: Assertion matches immediate notification handling scenario.The expectation of 2 AddToWallet events is correct for the scenario where block and mempool transactions are created after wallet load and notifications are processed immediately.
src/qt/splashscreen.cpp (2)
119-119: LGTM!Inlining the
getBadgeColor()call is safe and reduces an intermediate variable. The temporary (if any) lives until the end of the full expression, which is afterfillRectcompletes.
58-58: No issues found. ThegetTitleAddText()method returnsconst QString&, making the const reference binding on line 58 safe. The reference points to an internal member that persists for the program's lifetime, so all subsequent uses are valid.src/llmq/snapshot.cpp (1)
212-218: LGTM: Refactoring to direct output parameter with defensive reset.The change correctly refactors from using a local variable to writing directly into
response.mnListDiffAtHMinus4C. The defensive reset on line 216 ensures the field is in a clean state ifBuildSimplifiedMNListDifffails after partial modification, preserving the previous behavior where assignment would only occur on success.Note: This is the only
BuildSimplifiedMNListDiffcall in the file that explicitly resets its output parameter on failure, which appears intentional for the optionalextraSharefield.src/univalue/lib/univalue.cpp (4)
104-109: LGTM! Correct move-semantics optimization.The pass-by-value-then-move pattern is correctly implemented. This allows the compiler to elide copies when rvalues are passed while still supporting lvalues.
Based on learnings
118-124: LGTM! Consistent move optimization for key-value insertion.Both the key and value are correctly moved into storage, following the same optimization pattern as
push_back.Based on learnings
126-135: LGTM! Efficient key-value upsert with move semantics.The implementation correctly moves the value when replacing an existing key (line 132) and moves both key and value when adding a new entry (line 134).
Based on learnings
137-144: LGTM! Bulk key-value merge with efficient move semantics.The implementation correctly moves individual keys and values from the source object. Taking
objby value allows the caller to pass either an lvalue (which will be copied then consumed) or an rvalue (which will be moved then consumed).Based on learnings
src/univalue/include/univalue.h (1)
80-87: LGTM! Public API declarations correctly updated for move semantics.The method signatures are correctly updated to match the implementations in
univalue.cpp. This API change enables the pass-by-value-then-move optimization pattern across all container modification methods.Based on learnings
src/wallet/receive.cpp (1)
431-431: LGTM: Efficient iteration with const reference.The loop now binds
_groupingby const reference instead of by value, avoiding unnecessary copies of eachstd::set<CTxDestination>during iteration. This optimization is consistent with the broader pattern in this PR.ci/dash/lint-tidy.sh (1)
47-47: LGTM: CI tooling update.Adding
src/util/string.cppto the iwyu analysis set aligns with the code changes in that file within this PR.src/util/string.cpp (1)
13-13: LGTM: Correctly removed std::move from const reference.The change removes
std::move(search)wheresearchis aconst std::string¶meter. Since you cannot meaningfully move from a const reference, this is the correct approach. Thestd::regexconstructor will copy from the const reference as intended.src/bench/load_external.cpp (1)
31-31: LGTM: Safe const-reference binding to temporary.The change binds
paramsas a const reference to the temporary returned byParams(). In C++, this extends the temporary's lifetime to match the reference's scope, andparamsis used immediately on line 32 within the same scope. This optimization avoids an unnecessary copy without introducing lifetime issues.src/logging.cpp (1)
465-465: LGTM: Safe const-reference binding avoids copy.The change binds
threadnameas a const reference to the result ofutil::ThreadGetInternalName(), avoiding an unnecessary string copy. The reference is used immediately on line 467 within the same scope, and lifetime extension ensures safety.src/rpc/util.cpp (1)
102-102: LGTM: Const-reference bindings avoid unnecessary copies.All three changes bind local variables as const references to UniValue method results (
get_str()andgetValStr()), avoiding string copies. These methods typically return references to internal storage, and all usages occur within the same function scope:
- Line 102:
strHexused on lines 103-107- Line 129:
strNumused on lines 131-132- Line 138:
strNumused on lines 140-141Also applies to: 129-129, 138-138
src/rpc/rawtransaction_util.cpp (1)
149-149: LGTM: Const-reference bindings to UniValue internal data.Both changes bind to references of UniValue's internal data structures:
- Line 149:
prevTxsreferences the array and is iterated over starting at line 150- Line 156:
prevOutreferences the object and is used throughout lines 158-227These avoid unnecessary copies while remaining safe since the references point to internal storage of the parent UniValue objects that remain alive throughout the usage scope.
Also applies to: 156-156
src/bitcoin-cli.cpp (1)
951-951: No changes required; const-reference binding is safe.UniValue::get_str() returns
const std::string&, which is a reference to internal storage rather than a temporary. The binding in the code is therefore safe—the reference directly aliases the internal string, and no temporary lifetime extension applies. The code is correct as written.src/evo/mnauth.cpp (1)
39-39: Based on my verification of the codebase, I can now address the original review comment. The first shell script confirmed thatmn_activeman.GetPubKey()at line 39 returnsCBLSPublicKey(from src/masternode/node.h:80 and src/masternode/node.cpp:292:CBLSPublicKey CActiveMasternodeManager::GetPubKey() const).The original review comment raises a concern about asymmetry between how line 39 constructs the signHash directly with
GetPubKey()versus how ProcessMessage allegedly wraps the public key. However, I need to verify whether the ProcessMessage code at lines 92-94 actually exists as described and whether this inconsistency is genuinely problematic.Given that:
- Both code paths use
CBLSPublicKeyas the public key type- The PR summary indicates tests passed
- The comment references "See comment in PushMNAUTH" suggesting intentional symmetry
- I cannot locate the exact lines 92-94 in the search results to confirm the alleged asymmetry
The original review comment appears to be speculating about a potential issue without providing definitive evidence of the actual code implementation. The concern is that different methods of creating CBLSPublicKey objects might serialize differently, but this requires:
- Verifying ProcessMessage's actual implementation at lines 92-94
- Confirming whether CBLSPublicKey(dmn->pdmnState->pubKeyOperator.Get()) and GetPubKey() actually produce different serializations
Without access to the complete ProcessMessage implementation in the search results, and given that tests reportedly passed, the review comment's severity cannot be definitively confirmed.
Verify type consistency between PushMNAUTH and ProcessMessage signHash construction.
Line 39 now uses
mn_activeman.GetPubKey()directly in the signHash tuple, while the review claims line 92 inProcessMessagewraps the public key withCBLSPublicKeyconstructor. Both should serialize identically for MNAUTH to work. Confirm that both code paths produceCBLSPublicKeyobjects that serialize the same way, especially if they call constructors differently. If tests pass, the serialization is likely compatible, but manually verify the ProcessMessage implementation at lines 92-94 to ensure symmetric signHash computation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
src/evo/mnauth.cpp (1)
39-39: Fix clang-format violations.The formatting issue on this line was previously flagged. Please run
clang-formaton this file to fix the formatting differences detected by the pipeline.test/functional/wallet_balance.py (1)
283-305: Legacy mempool-import balance test logic looks correctThe new legacy-only block properly exercises
importaddressandimportprivkeyon fresh wallets with an unconfirmed tx, and themine/watchonlyuntrusted_pendingexpectations plus the conditionalwatchonlykey check match the stated Dash-vs-Bitcoin behavior. I don’t see correctness issues here.Based on learnings
🧹 Nitpick comments (1)
test/functional/rpc_wipewallettxes.py (1)
36-37: Test correctly validates mempool scanning behavior.The test properly validates that
rescanblockchain()now scans the mempool when called without parameters. The unconfirmed transaction from line 31 remains in the mempool afterwipewallettxes(True)removes it from the wallet, andrescanblockchain()successfully recovers it, restoring the transaction count to 104.Optional: Consider verifying the specific transaction for robustness.
The test currently only checks the transaction count. For additional robustness, you could verify that the specific transaction (
txid) is recovered:self.nodes[0].rescanblockchain() assert_equal(self.nodes[0].getwalletinfo()["txcount"], 104) # Verify the specific unconfirmed transaction was recovered from mempool self.nodes[0].gettransaction(txid)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (67)
ci/dash/lint-tidy.sh(1 hunks)src/.clang-tidy(1 hunks)src/bench/load_external.cpp(1 hunks)src/bench/wallet_loading.cpp(0 hunks)src/bitcoin-cli.cpp(1 hunks)src/bitcoin-tx.cpp(1 hunks)src/blockfilter.cpp(1 hunks)src/bls/bls_worker.cpp(1 hunks)src/coins.cpp(1 hunks)src/core_read.cpp(1 hunks)src/evo/creditpool.cpp(1 hunks)src/evo/mnauth.cpp(1 hunks)src/evo/specialtxman.cpp(1 hunks)src/init.cpp(1 hunks)src/instantsend/instantsend.cpp(1 hunks)src/llmq/blockprocessor.cpp(1 hunks)src/llmq/snapshot.cpp(1 hunks)src/logging.cpp(1 hunks)src/masternode/meta.cpp(1 hunks)src/netbase.cpp(3 hunks)src/node/blockstorage.cpp(1 hunks)src/qt/governancelist.cpp(1 hunks)src/qt/splashscreen.cpp(2 hunks)src/qt/transactionrecord.cpp(0 hunks)src/rpc/blockchain.cpp(1 hunks)src/rpc/coinjoin.cpp(1 hunks)src/rpc/evo.cpp(0 hunks)src/rpc/masternode.cpp(0 hunks)src/rpc/mining.cpp(3 hunks)src/rpc/output_script.cpp(0 hunks)src/rpc/rawtransaction_util.cpp(1 hunks)src/rpc/util.cpp(3 hunks)src/script/descriptor.cpp(2 hunks)src/test/base58_tests.cpp(2 hunks)src/test/blockfilter_tests.cpp(1 hunks)src/test/coinstatsindex_tests.cpp(0 hunks)src/test/evo_deterministicmns_tests.cpp(1 hunks)src/test/evo_trivialvalidation.cpp(1 hunks)src/test/fuzz/txorphan.cpp(1 hunks)src/test/key_io_tests.cpp(3 hunks)src/test/miniscript_tests.cpp(1 hunks)src/test/script_tests.cpp(1 hunks)src/test/sighash_tests.cpp(1 hunks)src/test/transaction_tests.cpp(4 hunks)src/test/util_tests.cpp(1 hunks)src/test/validation_block_tests.cpp(1 hunks)src/univalue/include/univalue.h(1 hunks)src/univalue/lib/univalue.cpp(2 hunks)src/util/message.cpp(0 hunks)src/util/strencodings.cpp(0 hunks)src/util/string.cpp(1 hunks)src/util/string.h(0 hunks)src/util/threadinterrupt.h(1 hunks)src/wallet/bdb.cpp(1 hunks)src/wallet/receive.cpp(1 hunks)src/wallet/rpc/backup.cpp(8 hunks)src/wallet/scriptpubkeyman.cpp(1 hunks)src/wallet/spend.cpp(1 hunks)src/wallet/test/bip39_tests.cpp(1 hunks)src/wallet/test/wallet_tests.cpp(3 hunks)src/wallet/wallet.cpp(2 hunks)src/wallet/walletdb.cpp(2 hunks)test/functional/rpc_wipewallettxes.py(1 hunks)test/functional/wallet_balance.py(1 hunks)test/functional/wallet_import_rescan.py(5 hunks)test/functional/wallet_importdescriptors.py(2 hunks)test/lint/run-lint-format-strings.py(0 hunks)
💤 Files with no reviewable changes (10)
- src/qt/transactionrecord.cpp
- src/util/string.h
- src/test/coinstatsindex_tests.cpp
- src/rpc/evo.cpp
- src/util/strencodings.cpp
- src/rpc/output_script.cpp
- src/rpc/masternode.cpp
- src/util/message.cpp
- src/bench/wallet_loading.cpp
- test/lint/run-lint-format-strings.py
✅ Files skipped from review due to trivial changes (2)
- src/test/fuzz/txorphan.cpp
- src/test/miniscript_tests.cpp
🚧 Files skipped from review as they are similar to previous changes (31)
- src/rpc/coinjoin.cpp
- src/qt/governancelist.cpp
- src/util/threadinterrupt.h
- src/evo/specialtxman.cpp
- src/rpc/rawtransaction_util.cpp
- src/core_read.cpp
- src/script/descriptor.cpp
- src/wallet/test/wallet_tests.cpp
- src/test/blockfilter_tests.cpp
- src/node/blockstorage.cpp
- src/instantsend/instantsend.cpp
- src/evo/creditpool.cpp
- src/coins.cpp
- src/blockfilter.cpp
- ci/dash/lint-tidy.sh
- src/test/util_tests.cpp
- src/masternode/meta.cpp
- src/llmq/blockprocessor.cpp
- src/test/key_io_tests.cpp
- src/wallet/receive.cpp
- src/test/base58_tests.cpp
- src/test/evo_trivialvalidation.cpp
- src/test/sighash_tests.cpp
- src/wallet/bdb.cpp
- src/rpc/blockchain.cpp
- src/init.cpp
- src/wallet/scriptpubkeyman.cpp
- src/logging.cpp
- src/util/string.cpp
- src/bitcoin-cli.cpp
- src/test/script_tests.cpp
🧰 Additional context used
🧠 Learnings (27)
📓 Common learnings
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/wallet/test/bip39_tests.cppsrc/rpc/util.cppsrc/test/transaction_tests.cpptest/functional/rpc_wipewallettxes.pysrc/wallet/walletdb.cppsrc/univalue/lib/univalue.cppsrc/wallet/wallet.cpptest/functional/wallet_importdescriptors.pysrc/wallet/rpc/backup.cpp
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
src/wallet/test/bip39_tests.cpptest/functional/rpc_wipewallettxes.pytest/functional/wallet_import_rescan.pytest/functional/wallet_importdescriptors.py
📚 Learning: 2025-11-14T23:17:08.495Z
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6976
File: src/stacktraces.cpp:475-482
Timestamp: 2025-11-14T23:17:08.495Z
Learning: In C++ code reviews, always check for opportunities to use standard algorithms (std::any_of, std::all_of, std::none_of, std::find_if, std::transform, std::for_each, etc.) instead of manual for-loops, especially when the loop body performs simple checks, transformations, or accumulations.
Applied to files:
src/test/validation_block_tests.cpp
📚 Learning: 2025-08-19T14:57:31.801Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Applied to files:
src/test/validation_block_tests.cpptest/functional/wallet_importdescriptors.py
📚 Learning: 2025-02-06T14:34:30.466Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Applied to files:
src/wallet/spend.cppsrc/wallet/wallet.cpptest/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-03T11:29:36.358Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6838
File: src/governance/signing.cpp:84-85
Timestamp: 2025-10-03T11:29:36.358Z
Learning: After bitcoin#25153 (included in dash#6775), UniValue uses the templated getInt<T>() API instead of the legacy get_int() and get_int64() methods. For example, use jproposal["start_epoch"].getInt<int64_t>() to retrieve int64_t values from UniValue objects.
Applied to files:
src/rpc/util.cpp
📚 Learning: 2025-02-14T15:15:58.165Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/rpc/governance.cpp:1074-1089
Timestamp: 2025-02-14T15:15:58.165Z
Learning: Code blocks marked with `// clang-format off` and `// clang-format on` directives should be excluded from clang-format suggestions as they are intentionally formatted manually for better readability.
Applied to files:
src/evo/mnauth.cpp
📚 Learning: 2025-10-25T07:08:51.918Z
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Applied to files:
src/univalue/include/univalue.hsrc/univalue/lib/univalue.cpptest/functional/wallet_importdescriptors.py
📚 Learning: 2025-06-20T23:32:16.225Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6726
File: test/functional/rpc_createmultisig.py:120-120
Timestamp: 2025-06-20T23:32:16.225Z
Learning: In the rpc_createmultisig.py test, the checkbalances() function correctly excludes 9 blocks from the balance calculation: 8 blocks from do_multisig() calls (2 blocks per call × 4 calls) plus 1 block from checkbalances() itself.
Applied to files:
test/functional/wallet_balance.pytest/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-02T18:29:54.756Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6840
File: src/net_processing.cpp:2882-2886
Timestamp: 2025-10-02T18:29:54.756Z
Learning: Across net_processing.cpp, once LLMQContext (m_llmq_ctx) is asserted non-null, its subcomponents (e.g., isman, qdkgsman, quorum_block_processor) are treated as initialized and used without extra null checks.
Applied to files:
src/rpc/mining.cpp
📚 Learning: 2025-08-10T13:52:46.289Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6666
File: test/functional/rpc_netinfo.py:73-81
Timestamp: 2025-08-10T13:52:46.289Z
Learning: In the Bitcoin/Dash test framework, `self.node.extra_args` contains the original startup arguments for a TestNode and is not modified by `test.restart_node()`. Each restart with new `extra_args` doesn't update the stored `self.node.extra_args`, so copying from it always provides a clean slate without accumulated modifications from previous restarts.
Applied to files:
test/functional/wallet_import_rescan.py
📚 Learning: 2025-02-14T15:19:17.218Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Applied to files:
src/wallet/wallet.cpp
📚 Learning: 2025-01-14T08:37:16.955Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6530
File: src/validation.cpp:360-362
Timestamp: 2025-01-14T08:37:16.955Z
Learning: The UpdateTransactionsFromBlock() method in txmempool.cpp takes parameters in the order: vHashUpdate, ancestor_size_limit, ancestor_count_limit. The size limit comes before the count limit.
Applied to files:
src/wallet/wallet.cpp
📚 Learning: 2025-09-09T21:36:58.969Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:223-232
Timestamp: 2025-09-09T21:36:58.969Z
Learning: In RawSender class (src/stats/rawsender.cpp), socket access operations (m_sock and m_server) should be protected by the cs_net mutex, not avoiding synchronization entirely. While lock overhead concerns are valid in general, socket operations require proper synchronization via cs_net.
Applied to files:
src/netbase.cpp
📚 Learning: 2025-09-09T21:36:11.833Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:0-0
Timestamp: 2025-09-09T21:36:11.833Z
Learning: In RawSender class (src/stats/rawsender.cpp), cs_net is the appropriate mutex for protecting socket access (m_sock) and network operations, not additional custom locks. The implementation correctly uses cs_net with GUARDED_BY annotations and EXCLUSIVE_LOCKS_REQUIRED to synchronize socket access between SendDirectly() and ReconnectThread().
Applied to files:
src/netbase.cpp
📚 Learning: 2025-09-09T21:36:31.504Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6837
File: src/stats/rawsender.cpp:0-0
Timestamp: 2025-09-09T21:36:31.504Z
Learning: In RawSender class (src/stats/rawsender.cpp), m_sock access requires synchronization using the cs_net mutex. The race condition exists between SendDirectly() (callable from any thread) and Connect() (called by ReconnectThread), where both read and write m_sock concurrently. The cs_net mutex properly coordinates these network operations.
Applied to files:
src/netbase.cpp
📚 Learning: 2025-10-28T18:36:40.263Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6923
File: src/test/util/setup_common.cpp:235-251
Timestamp: 2025-10-28T18:36:40.263Z
Learning: In `src/test/util/setup_common.cpp`, the `CEvoDB` instance in `BasicTestingSetup` is constructed with `.memory = true` flag (memory-only mode), so it does not create file handles on disk. This makes the destructor teardown order safe even if `fs::remove_all(m_path_root)` is called before `m_node.evodb.reset()`.
Applied to files:
src/test/evo_deterministicmns_tests.cpp
📚 Learning: 2025-01-07T18:50:44.838Z
Learnt from: knst
Repo: dashpay/dash PR: 6511
File: src/evo/deterministicmns.cpp:1369-1373
Timestamp: 2025-01-07T18:50:44.838Z
Learning: The functions `MigrateDBIfNeeded` and `MigrateDBIfNeeded2` in `src/evo/deterministicmns.cpp` are temporary and will be removed in a future version. Refactoring suggestions for these functions should be avoided.
Applied to files:
src/test/evo_deterministicmns_tests.cpp
📚 Learning: 2025-11-13T20:02:55.480Z
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6969
File: src/evo/deterministicmns.h:441-479
Timestamp: 2025-11-13T20:02:55.480Z
Learning: In `src/evo/deterministicmns.h`, the `internalId` field in `CDeterministicMN` and the `mnInternalIdMap` in `CDeterministicMNList` are non-deterministic and used only for internal bookkeeping and efficient lookups. Different nodes can assign different internalIds to the same masternode depending on their sync history. Methods like `IsEqual()` intentionally ignore internalId mappings and only compare consensus-critical deterministic fields (proTxHash, collateral, state, etc.).
Applied to files:
src/test/evo_deterministicmns_tests.cpp
📚 Learning: 2025-10-25T07:08:51.918Z
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-13T12:37:12.357Z
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-05T20:38:28.457Z
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-08-11T17:16:36.654Z
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-11-04T18:24:27.241Z
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6933
File: src/llmq/utils.cpp:284-298
Timestamp: 2025-11-04T18:24:27.241Z
Learning: In consensus-critical code (such as quorum formation, block validation, or deployment activation logic), do not suggest changes to the logic itself even if the implementation appears theoretically incorrect or off-by-one. Consensus rules, once deployed on the Dash network, must be preserved exactly to avoid network forks. Refactoring PRs should maintain perfect behavioral equivalence. Only suggest logic changes if explicitly accompanied by a DIP (Dash Improvement Proposal) or if the maintainer indicates the consensus rule needs to be changed with appropriate activation logic.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-08-01T07:46:37.840Z
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-07-17T15:48:29.418Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6752
File: src/wallet/load.cpp:164-164
Timestamp: 2025-07-17T15:48:29.418Z
Learning: In Dash Core, kwvg prefers using assert() statements to document expected behavior in code paths, especially when the called function also has internal asserts. This is used as a defensive programming pattern rather than requiring conditional error handling.
Applied to files:
test/functional/wallet_importdescriptors.py
🧬 Code graph analysis (6)
src/univalue/include/univalue.h (1)
src/univalue/lib/univalue.cpp (12)
push_back(104-109)push_back(104-104)push_backV(111-116)push_backV(111-111)__pushKV(118-124)__pushKV(118-118)key(188-198)key(188-188)pushKV(126-135)pushKV(126-126)pushKVs(137-144)pushKVs(137-137)
test/functional/rpc_wipewallettxes.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
test/functional/wallet_balance.py (2)
src/wallet/rpc/backup.cpp (7)
descriptors(2029-2029)dumpprivkey(831-875)dumpprivkey(831-831)importaddress(207-308)importaddress(207-207)importprivkey(87-179)importprivkey(87-87)test/functional/test_framework/util.py (1)
assert_equal(69-74)
test/functional/wallet_import_rescan.py (2)
test/functional/test_framework/util.py (1)
assert_equal(69-74)test/functional/test_framework/test_framework.py (2)
start_nodes(646-664)sync_mempools(834-860)
src/wallet/wallet.cpp (1)
src/wallet/wallet.h (1)
cs_wallet(592-592)
test/functional/wallet_importdescriptors.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
🔇 Additional comments (40)
src/bitcoin-tx.cpp (1)
558-558: LGTM! Valid optimization to avoid unnecessary copy.Changing from a copy to a const reference is a good optimization that avoids copying the UniValue object on each loop iteration. The reference is used read-only throughout the loop body, making this change safe and beneficial for performance.
src/bls/bls_worker.cpp (1)
18-18: LGTM! Efficient iteration with const reference.The change from by-value to by-const-reference iteration avoids unnecessary copying while maintaining the same semantics. Since
itemis only used for read-only operations (IsValid()andGetHash()), the const reference is both correct and more efficient.src/test/evo_deterministicmns_tests.cpp (1)
889-892: LGTM: Tests assignment operator cache-sharing behavior.The refactoring from copy-construction to default-construction followed by assignment intentionally exercises a different code path (copy assignment operator) to verify that the SML cache is properly shared. This complements the copy-constructor test at line 886-887.
src/wallet/test/bip39_tests.cpp (1)
28-28: LGTM! Const reference binding reduces copies.The change from value binding to const reference binding eliminates unnecessary copying of the
UniValuetest object while ensuring immutability in the test loop.src/test/transaction_tests.cpp (4)
156-156: LGTM! Const reference binding improves efficiency.Binding
testby const reference instead of copying reduces overhead in the test loop.
175-175: LGTM! Const reference binding prevents unnecessary copy.Binding
vinputby const reference eliminates copying of the array returned byget_array().
240-240: LGTM! Const reference binding reduces copies.Binding
testby const reference instead of copying improves efficiency in the tx_invalid test loop.
259-259: LGTM! Const reference binding eliminates copy overhead.Binding
vinputby const reference prevents copying of the array object in the tx_invalid test path.src/test/validation_block_tests.cpp (1)
185-185: LGTM! Const reference binding avoids shared_ptr copies.The change from
auto blocktoconst auto& blockeliminates unnecessary copying ofshared_ptrobjects (and associated reference count manipulation) while iterating over the blocks vector.src/wallet/rpc/backup.cpp (6)
94-95: LGTM! Documentation accurately reflects mempool scanning.The help text updates correctly clarify that the rescan parameter affects both blockchain and mempool scanning, and provide appropriate guidance for users about when to use rescanwallet.
Also applies to: 100-100
213-214: LGTM! Consistent documentation improvements.The help text updates match the pattern from importprivkey and accurately describe the rescan behavior including mempool scanning.
Also applies to: 223-223
411-412: LGTM! Documentation updates are consistent.The help text correctly describes the rescan parameter behavior including mempool scanning, consistent with the other import RPC methods.
Also applies to: 417-417
493-493: LGTM! Clear documentation of rescan behavior.The note accurately reflects that both blockchain and mempool are rescanned after a successful import.
1484-1485: LGTM! Documentation improvements are consistent.The help text updates accurately describe that rescan operations include both blockchain and mempool scanning, consistent with the other import RPC methods.
Also applies to: 1529-1529
1841-1841: LGTM! Documentation complete and accurate.The timestamp description correctly indicates that mempool scanning is included along with blockchain scanning, completing the consistent documentation improvements across all import RPC methods.
src/qt/splashscreen.cpp (2)
58-58: LGTM: Safe optimization to const reference.The const reference binding avoids copying the QString while remaining safe—the temporary's lifetime extends through the constructor scope, covering all uses of
titleAddText(lines 112, 116, 122).
119-119: LGTM: Eliminates unnecessary intermediate variable.Directly passing the return value of
getBadgeColor()tofillRectis a straightforward optimization that avoids an intermediate temporary.src/.clang-tidy (3)
1-14: LGTM! Expanded clang-tidy checks improve code quality.The addition of
bugprone-use-after-move,misc-unused-using-decls, and the three performance-related checks strengthens static analysis coverage.
26-28: LGTM! CheckOptions configuration is appropriate.Disabling
CheckTriviallyCopyableMovefor theperformance-move-const-argcheck reduces false positives when moving trivially copyable types.
15-25: Verify that performance-for-range-copy exclusion from WarningsAsErrors matches upstream Bitcoin Core.This is a backport PR, and backported changes should match the upstream configuration. The
performance-for-range-copycheck is enabled in the Checks section but not in WarningsAsErrors, while other performance checks are elevated. Confirm this configuration matches the current upstream Bitcoin Core .clang-tidy file to ensure the backport is accurate.src/llmq/snapshot.cpp (1)
215-216: LGTM! Clean refactoring to eliminate intermediate variable.The change correctly refactors the code to write directly to
response.mnListDiffAtHMinus4Cinstead of using an intermediate local variable. The defensive reset on failure (line 216) ensures a clean state ifBuildSimplifiedMNListDiffpartially modified the output before failing.src/wallet/spend.cpp (1)
316-322: LGTM! Move optimization is safe here.The change from
const COutput&toCOutput&enables moving coin objects into the result map. This is safe becauseAvailableCoinsListUnspent(wallet).all()returns a temporary vector, so moving from its elements avoids unnecessary copies without affecting other code.src/bench/load_external.cpp (1)
31-31: LGTM! Proper const-reference binding.The change binds the temporary returned by
Params()to a const reference, extending its lifetime to the end of the scope and avoiding an unnecessary copy.src/netbase.cpp (3)
393-396: LGTM! Simplified error checking.The direct comparison eliminates the unnecessary intermediate variable assignment when the result is only used once.
416-418: LGTM! Consistent with earlier simplification.
482-484: LGTM! Consistent pattern applied.src/rpc/mining.cpp (3)
134-134: LGTM! Const-reference binding avoids copy.The const reference binding extends the lifetime of the
Params()return value through the function scope, avoiding an unnecessary copy of theCChainParamsobject.
359-359: LGTM! Consistent optimization pattern.
758-758: LGTM! Avoids string copy.Binding the result of
lpval.get_str()to a const reference avoids copying the string.src/rpc/util.cpp (3)
102-107: LGTM! Const-reference binding reduces string copies.The const reference binding to
v.get_str()avoids copying the string. The lifetime is safe becausev(the UniValue parameter) outlives thestrHexreference within the function scope.
129-133: LGTM! Consistent optimization pattern.
138-142: LGTM! Consistent optimization pattern.src/univalue/include/univalue.h (1)
80-87: LGTM! Public API change enables move semantics.These signature changes from const-reference parameters to by-value parameters are intentional to enable move semantics. The implementation (visible in src/univalue/lib/univalue.cpp) uses
std::moveto efficiently transfer ownership. This is part of the upstream backport and aligns with the broader pattern of move optimizations in this PR.Based on learnings
src/wallet/wallet.cpp (1)
1685-1690: Mempool scan after full rescan is well‑gated and consistentThe updated comment and the
if (!max_height) { ... requestMempoolTransactions(*this); }block correctly extend full rescans to also cover the current mempool, and the cs_wallet locking pattern matches existing usage inpostInitProcess. No correctness or locking issues spotted.Also applies to: 1810-1813
src/univalue/lib/univalue.cpp (1)
104-109: Move‑aware UniValue mutators look correctSwitching these methods to take arguments by value and moving into internal storage avoids extra copies while preserving external semantics.
pushKVonly moveskeyafterfindKeyis done with it, andpushKVsiterates over a by‑value copy, avoiding aliasing issues. No issues found.Also applies to: 118-135, 137-144
src/wallet/walletdb.cpp (1)
887-912: Descriptor cache/key + mnemonic loading logic is coherentThe const‑ref loops over descriptor caches and keys are fine, and the new
AddKey/AddCryptedKeycalls correctly thread optional mnemonic data frommnemonics/crypted_mnemonics, falling back to empty values for legacy entries. Assumptions aboutGetScriptPubKeyMan(desc_id)being non‑null match the surrounding descriptor loading logic. No issues identified.test/functional/wallet_importdescriptors.py (1)
430-459: Multisig mempool visibility checks are well-wiredCapturing
send_txidand asserting its presence in node0’s mempool and inwmulti_pub.listunspent(0)correctly verifies that the descriptor-based watch-only wallet sees the unconfirmed multisig spend. This matches the intended mempool-rescan behavior and stays aligned with the upstream backport.Based on learnings
test/functional/wallet_import_rescan.py (3)
71-103: Confirmations and address-level checks are computed consistentlyUsing
confirmation_heightto deriveconfirmationsand applying the same value to both thelisttransactionsentry and thelistreceivedbyaddressentry is consistent, and treating a missing height as “mempool (0 conf)” matches the test’s intent. The optional"trusted"key assertion for confirmed txs is also safe in this context.
147-163: Whitelist restart in setup_network is appropriate for mempool-focused testsRestarting all nodes with
[email protected]after seeding coinbase keys is a reasonable way to ensure fast, reliable mempool propagation across the IMPORT_NODES matrix without altering the prune/txindex settings established earlier.
203-257: Mempool rescan variants are correctly isolated and verifiedThe new mempool path (reusing non-pruned, non-
late_timestampvariants, creating mempool-only txs, asserting mempool size, and then importing on the appropriate nodes based onrescanflag) cleanly tests that a rescan covers mempool entries while non-rescanning imports leave balances and tx counts at zero. State is reinitialized per variant, so earlier on-chain checks remain unaffected.
UdjinM6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 105af62
|
This pull request has conflicts, please rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (67)
-
ci/dash/lint-tidy.sh(1 hunks) -
src/.clang-tidy(1 hunks) -
src/bench/load_external.cpp(1 hunks) -
src/bench/wallet_loading.cpp(0 hunks) -
src/bitcoin-cli.cpp(1 hunks) -
src/bitcoin-tx.cpp(1 hunks) -
src/blockfilter.cpp(1 hunks) -
src/bls/bls_worker.cpp(1 hunks) -
src/coins.cpp(1 hunks) -
src/core_read.cpp(1 hunks) -
src/evo/creditpool.cpp(1 hunks) -
src/evo/mnauth.cpp(1 hunks) -
src/evo/specialtxman.cpp(1 hunks) -
src/init.cpp(1 hunks) -
src/instantsend/instantsend.cpp(1 hunks) -
src/llmq/blockprocessor.cpp(1 hunks) -
src/llmq/snapshot.cpp(1 hunks) -
src/logging.cpp(1 hunks) -
src/masternode/meta.cpp(1 hunks) -
src/netbase.cpp(3 hunks) -
src/node/blockstorage.cpp(1 hunks) -
src/qt/governancelist.cpp(1 hunks) -
src/qt/splashscreen.cpp(2 hunks) -
src/qt/transactionrecord.cpp(0 hunks) -
src/rpc/blockchain.cpp(1 hunks) -
src/rpc/coinjoin.cpp(1 hunks) -
src/rpc/evo.cpp(0 hunks) -
src/rpc/masternode.cpp(0 hunks) -
src/rpc/mining.cpp(3 hunks) -
src/rpc/output_script.cpp(0 hunks) -
src/rpc/rawtransaction_util.cpp(1 hunks) -
src/rpc/util.cpp(3 hunks) -
src/script/descriptor.cpp(2 hunks) -
src/test/base58_tests.cpp(2 hunks) -
src/test/blockfilter_tests.cpp(1 hunks) -
src/test/coinstatsindex_tests.cpp(0 hunks) -
src/test/evo_deterministicmns_tests.cpp(1 hunks) -
src/test/evo_trivialvalidation.cpp(1 hunks) -
src/test/fuzz/txorphan.cpp(1 hunks) -
src/test/key_io_tests.cpp(3 hunks) -
src/test/miniscript_tests.cpp(1 hunks) -
src/test/script_tests.cpp(1 hunks) -
src/test/sighash_tests.cpp(1 hunks) -
src/test/transaction_tests.cpp(4 hunks) -
src/test/util_tests.cpp(1 hunks) -
src/test/validation_block_tests.cpp(1 hunks) -
src/univalue/include/univalue.h(1 hunks) -
src/univalue/lib/univalue.cpp(2 hunks) -
src/util/message.cpp(0 hunks) -
src/util/strencodings.cpp(0 hunks) -
src/util/string.cpp(1 hunks) -
src/util/string.h(0 hunks) -
src/util/threadinterrupt.h(1 hunks) -
src/wallet/bdb.cpp(1 hunks) -
src/wallet/receive.cpp(1 hunks) -
src/wallet/rpc/backup.cpp(8 hunks) -
src/wallet/scriptpubkeyman.cpp(1 hunks) -
src/wallet/spend.cpp(1 hunks) -
src/wallet/test/bip39_tests.cpp(1 hunks) -
src/wallet/test/wallet_tests.cpp(3 hunks) -
src/wallet/wallet.cpp(2 hunks) -
src/wallet/walletdb.cpp(2 hunks) -
test/functional/rpc_wipewallettxes.py(1 hunks) -
test/functional/wallet_balance.py(1 hunks) -
test/functional/wallet_import_rescan.py(5 hunks) -
test/functional/wallet_importdescriptors.py(2 hunks) -
test/lint/run-lint-format-strings.py(0 hunks)
💤 Files with no reviewable changes (10)
- src/rpc/evo.cpp
- test/lint/run-lint-format-strings.py
- src/util/message.cpp
- src/rpc/output_script.cpp
- src/rpc/masternode.cpp
- src/util/string.h
- src/test/coinstatsindex_tests.cpp
- src/bench/wallet_loading.cpp
- src/util/strencodings.cpp
- src/qt/transactionrecord.cpp
✅ Files skipped from review due to trivial changes (1)
- src/util/threadinterrupt.h
🚧 Files skipped from review as they are similar to previous changes (31)
- src/wallet/receive.cpp
- src/.clang-tidy
- src/test/util_tests.cpp
- src/test/fuzz/txorphan.cpp
- src/script/descriptor.cpp
- src/wallet/scriptpubkeyman.cpp
- src/wallet/wallet.cpp
- src/wallet/bdb.cpp
- src/evo/specialtxman.cpp
- src/bitcoin-cli.cpp
- src/test/key_io_tests.cpp
- src/blockfilter.cpp
- src/masternode/meta.cpp
- src/rpc/coinjoin.cpp
- src/rpc/mining.cpp
- src/netbase.cpp
- ci/dash/lint-tidy.sh
- src/test/evo_trivialvalidation.cpp
- src/test/evo_deterministicmns_tests.cpp
- src/test/sighash_tests.cpp
- src/wallet/walletdb.cpp
- src/bls/bls_worker.cpp
- src/node/blockstorage.cpp
- src/llmq/snapshot.cpp
- src/test/miniscript_tests.cpp
- src/test/base58_tests.cpp
- test/functional/wallet_balance.py
- src/wallet/test/wallet_tests.cpp
- src/bitcoin-tx.cpp
- src/logging.cpp
- src/llmq/blockprocessor.cpp
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
📚 Learning: 2025-10-03T11:29:36.358Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6838
File: src/governance/signing.cpp:84-85
Timestamp: 2025-10-03T11:29:36.358Z
Learning: After bitcoin#25153 (included in dash#6775), UniValue uses the templated getInt<T>() API instead of the legacy get_int() and get_int64() methods. For example, use jproposal["start_epoch"].getInt<int64_t>() to retrieve int64_t values from UniValue objects.
Applied to files:
src/qt/governancelist.cppsrc/rpc/util.cpp
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/test/script_tests.cppsrc/wallet/test/bip39_tests.cppsrc/rpc/rawtransaction_util.cppsrc/test/transaction_tests.cpptest/functional/wallet_importdescriptors.pysrc/wallet/rpc/backup.cppsrc/rpc/util.cpptest/functional/rpc_wipewallettxes.py
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
src/wallet/test/bip39_tests.cpptest/functional/wallet_import_rescan.pytest/functional/wallet_importdescriptors.py
📚 Learning: 2025-02-06T14:34:30.466Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Applied to files:
src/instantsend/instantsend.cppsrc/wallet/spend.cpptest/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-25T07:08:51.918Z
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Applied to files:
src/rpc/rawtransaction_util.cppsrc/univalue/include/univalue.hsrc/univalue/lib/univalue.cpptest/functional/wallet_importdescriptors.py
📚 Learning: 2025-08-10T13:52:46.289Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6666
File: test/functional/rpc_netinfo.py:73-81
Timestamp: 2025-08-10T13:52:46.289Z
Learning: In the Bitcoin/Dash test framework, `self.node.extra_args` contains the original startup arguments for a TestNode and is not modified by `test.restart_node()`. Each restart with new `extra_args` doesn't update the stored `self.node.extra_args`, so copying from it always provides a clean slate without accumulated modifications from previous restarts.
Applied to files:
test/functional/wallet_import_rescan.py
📚 Learning: 2025-02-14T15:15:58.165Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/rpc/governance.cpp:1074-1089
Timestamp: 2025-02-14T15:15:58.165Z
Learning: Code blocks marked with `// clang-format off` and `// clang-format on` directives should be excluded from clang-format suggestions as they are intentionally formatted manually for better readability.
Applied to files:
src/evo/mnauth.cpp
📚 Learning: 2025-06-20T23:32:16.225Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6726
File: test/functional/rpc_createmultisig.py:120-120
Timestamp: 2025-06-20T23:32:16.225Z
Learning: In the rpc_createmultisig.py test, the checkbalances() function correctly excludes 9 blocks from the balance calculation: 8 blocks from do_multisig() calls (2 blocks per call × 4 calls) plus 1 block from checkbalances() itself.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-25T07:08:51.918Z
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-13T12:37:12.357Z
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-10-05T20:38:28.457Z
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-08-11T17:16:36.654Z
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-11-04T18:24:27.241Z
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6933
File: src/llmq/utils.cpp:284-298
Timestamp: 2025-11-04T18:24:27.241Z
Learning: In consensus-critical code (such as quorum formation, block validation, or deployment activation logic), do not suggest changes to the logic itself even if the implementation appears theoretically incorrect or off-by-one. Consensus rules, once deployed on the Dash network, must be preserved exactly to avoid network forks. Refactoring PRs should maintain perfect behavioral equivalence. Only suggest logic changes if explicitly accompanied by a DIP (Dash Improvement Proposal) or if the maintainer indicates the consensus rule needs to be changed with appropriate activation logic.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-08-19T14:57:31.801Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Applied to files:
test/functional/wallet_importdescriptors.pysrc/test/validation_block_tests.cpp
📚 Learning: 2025-08-01T07:46:37.840Z
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Applied to files:
test/functional/wallet_importdescriptors.py
📚 Learning: 2025-07-17T15:48:29.418Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6752
File: src/wallet/load.cpp:164-164
Timestamp: 2025-07-17T15:48:29.418Z
Learning: In Dash Core, kwvg prefers using assert() statements to document expected behavior in code paths, especially when the called function also has internal asserts. This is used as a defensive programming pattern rather than requiring conditional error handling.
Applied to files:
test/functional/wallet_importdescriptors.py
🧬 Code graph analysis (7)
src/evo/creditpool.cpp (2)
src/net_processing.cpp (1)
tx(1082-1082)src/test/fuzz/tx_pool.cpp (4)
tx(66-69)tx(66-66)tx(71-74)tx(71-71)
src/rpc/blockchain.cpp (3)
src/test/script_tests.cpp (1)
script(286-286)src/wallet/interfaces.cpp (4)
script(190-197)script(190-190)script(206-210)script(206-206)src/script/descriptor.cpp (2)
scripts(758-763)scripts(758-758)
src/rpc/rawtransaction_util.cpp (1)
src/rpc/request.cpp (2)
JSONRPCError(56-62)JSONRPCError(56-56)
test/functional/wallet_import_rescan.py (2)
test/functional/test_framework/util.py (1)
assert_equal(69-74)test/functional/test_framework/test_framework.py (2)
start_nodes(646-664)sync_mempools(834-860)
src/univalue/include/univalue.h (1)
src/univalue/lib/univalue.cpp (12)
push_back(104-109)push_back(104-104)push_backV(111-116)push_backV(111-111)__pushKV(118-124)__pushKV(118-118)key(188-198)key(188-188)pushKV(126-135)pushKV(126-126)pushKVs(137-144)pushKVs(137-137)
test/functional/wallet_importdescriptors.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
test/functional/rpc_wipewallettxes.py (1)
test/functional/test_framework/util.py (1)
assert_equal(69-74)
🪛 GitHub Actions: Clang Diff Format Check
src/evo/mnauth.cpp
[error] 1-1: Clang format differences found by clang-format-diff.py. Exit code 1. Command: git diff -U0 origin/develop --
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: mac-build / Build source
- GitHub Check: win64-build / Build source
- GitHub Check: linux64_tsan-build / Build source
- GitHub Check: linux64_nowallet-build / Build source
- GitHub Check: linux64_ubsan-build / Build source
- GitHub Check: linux64_sqlite-build / Build source
- GitHub Check: linux64_fuzz-build / Build source
- GitHub Check: linux64-build / Build source
- GitHub Check: arm-linux-build / Build source
- GitHub Check: Lint / Run linters
🔇 Additional comments (35)
src/coins.cpp (1)
359-359: LGTM! Performance optimization by avoiding unnecessary copies.The change from
autotoconst auto&prevents copying each callback object during iteration, which is the standard C++ best practice for range-based for loops when elements don't need to be modified.src/instantsend/instantsend.cpp (1)
104-110: LGTM! Valid move-semantics optimization.The change from
const auto&toauto&correctly enables movingnodeid_islptr_pairinto the return container on line 110, avoiding unnecessary copies. The moved-from entries are properly erased afterward (lines 114-116), making this a standard and safe optimization pattern.src/qt/splashscreen.cpp (2)
58-58: LGTM! Optimization reduces unnecessary QString copy.The const reference binding eliminates a QString copy while remaining safe due to C++ lifetime extension semantics.
119-119: LGTM! Eliminates unnecessary intermediate variable.Directly passing the return value to
fillRectis cleaner and avoids an unnecessary temporary.src/wallet/rpc/backup.cpp (6)
94-95: LGTM! Documentation updated to reference mempool scanning.The help text updates correctly document that rescan now covers both chain and mempool, and provide clear guidance on when to use
rescan=falseand therescanwalletcommand.Also applies to: 100-100
213-214: LGTM! Consistent documentation updates.The help text updates for
importaddressmatch the pattern fromimportprivkey, ensuring consistent messaging about mempool scanning across related RPC commands.Also applies to: 223-223
411-412: LGTM! Consistent documentation updates.The help text updates for
importpubkeymaintain consistency with the other import commands, providing the same guidance about rescan behavior and mempool scanning.Also applies to: 417-417
493-493: LGTM! Documentation clarifies rescan behavior.The updated help text clearly indicates that both blockchain and mempool will be rescanned after a successful wallet import.
1484-1485: LGTM! Consistent documentation updates.The help text updates for
importmultimaintain consistency with the other import commands, documenting both the rescan guidance and mempool scanning behavior.Also applies to: 1529-1529
1841-1841: LGTM! Documentation updated to reference mempool scanning.The timestamp description now correctly indicates that mempool will be scanned in addition to the blockchain.
src/wallet/spend.cpp (1)
316-321: Move-enablingListCoinsloop looks correctUsing
COutput&here to allowemplace_back(std::move(coin))is safe: the range-for materializes thestd::vector<COutput>temporary for the loop duration, you only move from each element after all its data is consumed, and the temporary vector isn’t used afterward. Behavior stays the same while avoiding an extra copy per output.src/evo/creditpool.cpp (1)
94-94: LGTM: Reduces overhead by avoiding shared_ptr copies.The change from value-based to const-reference iteration avoids unnecessary reference count operations on
CTransactionRef(ashared_ptr), improving performance without altering behavior.src/rpc/blockchain.cpp (1)
2530-2534: Valid move optimization – verified and approved.Changing to non-const reference enables moving scripts into the
descriptorsmap viastd::move(script), avoiding copies. Sincescriptsis a local variable that isn't used after this loop, moving from it is safe and improves performance. Verification confirms no usage ofscriptsafter line 2534.src/qt/governancelist.cpp (1)
46-64: LGTM! Const-reference optimization avoids copies.The change from by-value to const-reference bindings when extracting UniValue fields is correct. The temporaries returned by
find_value()have their lifetimes extended to the enclosing scope, and all subsequent operations (.isStr(),.getInt<>(),.get_real(), etc.) work correctly with const references.src/core_read.cpp (1)
192-192: LGTM! Const-reference binding is correct.Binding
strHashTypeas a const reference to the temporary returned bysighash.get_str()is safe. The temporary's lifetime is extended to the end of the scope, covering all uses (map lookup and error message).src/init.cpp (1)
1443-1443: LGTM! Const-reference binding is correct.Binding
datadiras a const reference to the temporary returned bygArgs.GetDataDirNet()is safe. The temporary's lifetime is extended through the subsequent calls toDirIsWritable()andLockDirectory().src/util/string.cpp (1)
13-13: LGTM! Removed unnecessary std::move on const reference.The change correctly removes
std::move()on thesearchparameter, which is a const reference. Moving from a const reference is not possible and has no effect, so this change aligns with best practices.src/bench/load_external.cpp (1)
31-31: LGTM! Const-reference binding avoids copy.Binding
paramsas a const reference to the temporary returned byParams()is correct. The temporary's lifetime is extended to the end of the scope, and the subsequent call toMessageStart()works correctly with a const reference.src/rpc/rawtransaction_util.cpp (1)
149-156: LGTM! Const-reference bindings avoid copies.Both changes correctly bind to const references:
- Line 149:
prevTxsbinds to the array returned byget_array(), extending the temporary's lifetime for the loop.- Line 156:
prevOutbinds to the object returned byget_obj(), extending the temporary's lifetime for the iteration.All subsequent operations work correctly with const references.
src/rpc/util.cpp (1)
102-142: LGTM! Const-reference bindings avoid copies.All three changes correctly bind string temporaries as const references:
- Line 102 in
ParseHashV:strHexbound tov.get_str()- Line 129 in
ParseInt32V:strNumbound tov.getValStr()- Line 138 in
ParseInt64V:strNumbound tov.getValStr()The temporaries' lifetimes are extended to the end of each function scope, covering all uses (length checks, hex validation, parsing, and error messages).
src/wallet/test/bip39_tests.cpp (1)
28-28: LGTM! Const-reference binding avoids copies in loop.The change from by-value to const-reference binding for the
testelement is correct. This avoids copying each UniValue test element during iteration while maintaining the same functionality.src/test/blockfilter_tests.cpp (1)
145-186: Const-ref binding for JSON test element is safe and avoids copies
const UniValue& test = tests[i];is used read-only throughout the loop andtestsoutlives the reference, so this is a pure allocation win with no behavioral change.src/test/transaction_tests.cpp (1)
155-176: Const-ref UniValue bindings in tx_valid/tx_invalid are correctBoth
const UniValue& test = tests[idx];andconst UniValue& vinput = input.get_array();are used purely read-only, with owningtests/inputsobjects alive for the loop. This preserves behavior and reduces copies.Also applies to: 239-260
src/test/validation_block_tests.cpp (1)
175-190: Const-ref iteration overblocksis thread-safe and avoids extra shared_ptr copies
blocksis populated before the worker threads start and is never mutated, so iterating asfor (const auto& block : blocks)is safe under concurrency and slightly cheaper than copying eachshared_ptr.src/test/script_tests.cpp (1)
881-901: Use ofconst UniValue& testin script_json_test is safe
testis accessed read-only andtestslives for the whole function, so binding by const reference is correct and just reduces copying.test/functional/rpc_wipewallettxes.py (1)
30-37: Updated txcount expectation after rescan reflects mempool-aware rescanThe added
rescanblockchain()andassert_equal(..., 104)afterwipewallettxes(True)are consistent with the behavior where a rescan (with no max_height) also inspects the mempool and re-discovers the wiped unconfirmed transaction, restoring the txcount from 103 back to 104. The ordering (assertinggettransactionfails before rescan) correctly separates wipe behavior from rescan behavior.test/functional/wallet_importdescriptors.py (1)
422-432: Multisig descriptor send tracking and new change address expectation look correct
- Capturing
send_txidfromwmulti_priv.sendtoaddress(...)and later asserting it is present both in node0’s mempool and inwmulti_pub.listunspent(0)validates that:
- the multisig spend is relayed across nodes, and
- the watch‑only descriptor wallet correctly tracks the resulting UTXO.
- The updated
change_addrliteral is just the deterministic descriptor-derived address at the expected index; no behavioral risk.- Using bare
assert(...)here is consistent with the upstream test style for this backport.Also applies to: 453-460
src/univalue/lib/univalue.cpp (1)
104-144: UniValue move-based push APIs are semantically safe and improve efficiencyThe switch to pass‑by‑value plus
std::moveinpush_back,__pushKV,pushKV, andpushKVsfollows the standard “take by value, move into storage” pattern:
- Lookups in
pushKVusekeybefore it’s moved, so key search is safe.- Assigning
values[idx] = std::move(val);only moves from the parameter copy, never from the existing element.pushKVs(UniValue obj)correctly preserves callers that pass lvalues (they get a copy) and enables efficient moves when given rvalues.Behavior is preserved while allowing cheaper rvalue usage; no aliasing or lifetime issues are introduced.
src/univalue/include/univalue.h (1)
80-88: Header signatures for UniValue push methods correctly reflect the new move-friendly APIThe updated declarations for
push_back,__pushKV,pushKV, andpushKVsmatch the move-based implementations inunivalue.cppand remain source-compatible for existing callers, while enabling efficient rvalue usage. No ABI or semantic issues are apparent.test/functional/wallet_import_rescan.py (6)
78-82: Whitespace-only change aroundaddressesretrievalThe added blank line after the
listreceivedbyaddresscall is purely cosmetic and has no functional impact.
92-102: Confirmations and mempool handling logic looks correct
confirmations = (1 + current_height - confirmation_height) if confirmation_height else 0matches the usual confirmations formula and cleanly handles the mempool case (whereconfirmation_heightis omitted and confirmations should be 0).- Reusing the same
confirmationsvalue for both the tx and address-levelconfirmationskeeps these views consistent.- The
if confirmations: assert "trusted" not in txguard only triggers for confirmed transactions; for the mempool-rescan checks (whereconfirmation_heightis left asNone),confirmationsis 0 so this assertion is skipped as intended.This aligns with the upstream Bitcoin Core behavior being backported.
Based on learnings
161-163: Second startup with[email protected]is wired correctlyRestarting all nodes with
extra_args=[["[email protected]"]] * self.num_nodescorrectly appends the whitelist flag to each node’s existing per-node arguments (including prune/txindex/reindex) defined inself.extra_args, without mutating the storedextra_argsthemselves. This matches the test framework’sstart_nodes/TestNode.startsemantics and the prior learning aboutextra_argshandling.Based on learnings
165-165: Blank line before main test bodyThe added blank line before the main
run_testlogic is just formatting and does not alter behavior.
203-209: Refined loop for second set of confirmed sendsIterating directly over
IMPORT_VARIANTS(withoutenumerate) to create the second batch of sends keeps semantics identical while staying clear and concise. The per-variantsent_amount,sent_txid, and updatedconfirmation_heightare all set before later checks, so the follow-up balance/txcount assertions remain correct.
220-257: New mempool-rescan coverage is coherent and consistent with earlier logic
- Filtering
mempool_variantsto non-late_timestampand non-pruned variants matches the intent: mempool rescan is only meaningful on unpruned nodes and doesn’t need the late-timestamp edge case.- Capturing a single
timestampfrom the current tip and then sending per-variant txs without mining any blocks ensures all these txs stay in the mempool;assert_equal(len(self.nodes[0].getrawmempool()), len(mempool_variants))andself.sync_mempools()together guarantee all nodes see the same mempool contents before imports.- The node selection via
ImportNode(variant.prune, expect_rescan)reuses the same mapping as in the confirmed-rescan tests, now restricted toprune=False, so rescan/non-rescan behavior is exercised on the intended nodes.- For
expect_rescanvariants, settingconfirmation_height = 0and callingvariant.check(variant.initial_txid, variant.initial_amount)(relying on the defaultconfirmation_height=None) drives the new mempool-awareconfirmationslogic, expecting0confirmations and the correct balance/tx count.- For non-rescan variants, expected balance/txs are explicitly zeroed and
variant.check()is called without a txid, so the test asserts the absence of any imported mempool activity.Overall this block cleanly exercises the mempool-rescan behavior added upstream without introducing Dash-specific regressions.
Based on learnings
| auto pk = mn_activeman.GetPubKey(); | ||
| const CBLSPublicKey pubKey(pk); | ||
| const uint256 signHash{::SerializeHash(std::make_tuple(pubKey, receivedMNAuthChallenge, peer.IsInboundConn(), nOurNodeVersion))}; | ||
| const uint256 signHash{::SerializeHash(std::make_tuple(mn_activeman.GetPubKey(), receivedMNAuthChallenge, peer.IsInboundConn(), nOurNodeVersion))}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix persistent clang-format violations.
The pipeline continues to report formatting differences in this file. Although a previous comment indicated this was addressed, the current pipeline failure shows clang-format compliance is still required.
Run the following command to verify and fix formatting:
#!/bin/bash
# Show the formatting differences detected by clang-format
clang-format src/evo/mnauth.cpp | diff -u src/evo/mnauth.cpp - || echo "Formatting differences detected"🤖 Prompt for AI Agents
In src/evo/mnauth.cpp around line 39, the expression constructing signHash is
violating clang-format rules; run clang-format on this file (or the repo) and
apply the formatting changes so the line matches the project's clang-format
style (e.g., wrap/align long tuple arguments or split into multiple lines as
clang-format dictates), then re-run the provided diff command to confirm no
formatting differences remain and commit the modified file.
|
This pull request has conflicts, please rebase. |
…-format-strings.py 5b8f248 lint: remove no-longer used exceptions from lint-format-strings.py (fanquake) Pull request description: ACKs for top commit: laanwj: ACK 5b8f248 if it passes CI hebasto: ACK 5b8f248, I've verified that all of the remained false positive cases are valid. Tree-SHA512: 25c40714d271c57fb09c963a3372b62c7b4f2e9367517cdf5c73ea82527a9c4c477f8b7857e37adc7eb9feea1f0a37435059798ddf2195dee3522bed3a6eea44
… attempt 1be7964 test, wallet: Add mempool rescan test for import RPCs (Fabian Jahr) 833ce76 rpc, wallet: Document mempool rescan after importdescriptor, importwallet (Fabian Jahr) 0e396d1 rpc, wallet: Document mempool scan after importmulti (Fabian Jahr) e6d3ef8 rpc, wallet: Document mempool scan after importpubkey (Fabian Jahr) 6d3db52 rpc, wallet: Document and test mempool scan after importprivkey (João Barbosa) 3abdbbb rpc, wallet: Document and test mempool scan after importaddress (João Barbosa) 236239b wallet: Rescan mempool for transactions as well (Fabian Jahr) Pull request description: This PR picks up the work from bitcoin#18964 and closes bitcoin#18954. It should incorporate all the unaddressed feedback from the PR: - Mempool rescan now expanded to all relevant import* RPCs - Added documentation in the help of each RPC - More tests ACKs for top commit: Sjors: re-utACK 1be7964 (only a test change) achow101: ACK 1be7964 w0xlt: reACK bitcoin@1be7964 Tree-SHA512: b62fed5f97c6c242b2af417b41c9696a1f18878483d9e1c9429791f9c05257f57a00540a9a84df23c49faf6a61c3109c22972de81540083f38b506217804fcc5
a02f3f1 tidy: use misc-unused-using-decls (fanquake) d6787bc refactor: remove unused using directives (fanquake) 3617634 validation: remove unused using directives (eugene) Pull request description: Adds https://clang.llvm.org/extra/clang-tidy/checks/misc/unused-using-decls.html to our clang-tidy. PR'd after the discussion in bitcoin#25433 (which it includes). ACKs for top commit: jamesob: Github ACK bitcoin@a02f3f1 Tree-SHA512: 2bb937c1cc90006e69054458d845fb54f287567f4309c773a3fc859f260558c32ff51fc1c2ce9b43207426f3547e7ce226c87186103d741d5efcca19cd355253
f345dc3 tidy: enable bugprone-use-after-move (fanquake) 94f2235 test: work around bugprone-use-after-move warnings in util tests (fanquake) Pull request description: Would have caught bitcoin#25640. Currently `// NOLINT`s around: ```bash test/util_tests.cpp:2513:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v2[0].origin == &t2); ^ test/util_tests.cpp:2511:15: note: move occurred here auto v2 = Vector(std::move(t2)); ^ test/util_tests.cpp:2519:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v3[1].origin == &t2); ^ test/util_tests.cpp:2516:15: note: move occurred here auto v3 = Vector(t1, std::move(t2)); ^ test/util_tests.cpp:2527:34: error: 't3' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v4[2].origin == &t3); ^ test/util_tests.cpp:2523:15: note: move occurred here auto v4 = Vector(std::move(v3[0]), v3[1], std::move(t3)); ``` See: https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-use-after-move.html ACKs for top commit: ryanofsky: Code review ACK f345dc3. Only change since last review is switching to NOLINT directives Tree-SHA512: afadecbaf1069653f4be5d6e66a5800ffd975c0b1a960057abc6367b616c181cd518897a874a8f3fd5e5e1f45fcc165f7a9a3171136cd4deee641214c4b765b8
… unnecessarily copying objects and enable two clang-tidy checks
BACKPORT NOTE:
Somehow there's multiple warnings that are for backported code, mostly related to mempool, such as:
rpc/mempool.cpp:549:33: error: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy,-warnings-as-errors]
549 | for (CTxMemPool::txiter descendantIt : setDescendants) {
| ^
| const &
I can't find a way to fix it without big diversity of codebase, so, make as partial temporary
ae7ae36 tidy: Enable two clang-tidy checks (Aurèle Oulès)
081b0e5 refactor: Make const refs vars where applicable (Aurèle Oulès)
Pull request description:
I added const references to some variables to avoid unnecessarily copying objects.
Also added two clang-tidy checks : [performance-for-range-copy](https://releases.llvm.org/11.1.0/tools/clang/tools/extra/docs/clang-tidy/checks/performance-for-range-copy.html) and [performance-unnecessary-copy-initialization](https://releases.llvm.org/12.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/performance-unnecessary-copy-initialization.html).
ACKs for top commit:
vasild:
ACK ae7ae36
MarcoFalke:
review ACK ae7ae36
Tree-SHA512: f6ac6b0cd0eee1e0c34d2f186484bc0f7ec6071451cccb33fa88a67d93d92b304e2fac378b88f087e94657745bca4e966dbc443759587400eb01b1f3061fde8c
850b085 fix comment spellings from the codespell lint (Greg Weber) Pull request description: test/lint/all-lint.py includes the codespell lint ACKs for top commit: aureleoules: ACK 850b085. Tree-SHA512: bf63690da2652886e705d6594903bab67ff0f35a0e5a5505f063827f5148ebce47681e541cbe0e52396baf1addb25d9fe50e5faa9176456f579a7cd2f1321c44
BACKPORT NOTE: Some missing changes for TRDescriptor and for mempool_args But they will be caugth by linter ---- fa87534 Fix iwyu (MacroFake) faad673 Fix issues when calling std::move(const&) (MacroFake) Pull request description: Passing a symbol to `std::move` that is marked `const` is a no-op, which can be fixed in two ways: * Remove the `const`, or * Remove the `std::move` ACKs for top commit: ryanofsky: Code review ACK fa87534. Looks good. Good for univalue to support c++11 move optimizations Tree-SHA512: 3dc5cad55b93cfa311abedfb811f35fc1b7f30a1c68561f15942438916c7de25e179c364be11881e01f844f9c2ccd71a3be55967ad5abd2f35b10bb7a882edea
|
25872: clang-tidy complains a lot https://github.com/dashpay/dash/actions/runs/19578369597/job/56069899493?pr=6980 |
…nnecessary-copy-initialization errors 3305972 refactor: Fix remaining clang-tidy performance-unnecessary-copy-initialization errors (Lőrinc) Pull request description: A follow-up of bitcoin#31305. The `clang-tidy` check can be run via: ```bash cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DBUILD_FOR_FUZZING=ON && cmake --build build -j$(nproc) run-clang-tidy -quiet -p build -j $(nproc) -checks='-*,performance-unnecessary-copy-initialization' | grep -v 'clang-tidy' ``` ACKs for top commit: maflcko: review ACK 3305972 🏀 achow101: ACK 3305972 theuni: ACK the much more constrained 3305972. hebasto: ACK 3305972, tested with clang 19.1.5 + clang-tidy. Tree-SHA512: 64dc3b35f33b7ac064ebf9e56e9f0ceca5d26681a1379dcd2168987960020fe1a282ec4de8c353c82ddf0a534a4866b607fc691e690010c6cea78887045897fb
…nefficient-vector errors 11f3bc2 refactor: Reserve vectors in fuzz tests (Lőrinc) 152fefe refactor: Preallocate PrevectorFillVector(In)Direct without vector resize (Lőrinc) a774c7a refactor: Fix remaining clang-tidy performance-inefficient-vector errors (Lőrinc) Pull request description: PR inspired by bitcoin#29608 (comment) (and bitcoin#29458, bitcoin#29606, bitcoin#29607, bitcoin#30093). The `clang-tidy` check can be run via: ```bash cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DBUILD_FOR_FUZZING=ON && cmake --build build -j$(nproc) run-clang-tidy -quiet -p build -j $(nproc) -checks='-*,performance-inefficient-vector-operation' | grep -v 'clang-tidy' ``` which revealed 3 tests and 1 prod warning (+ fuzz and benching, found by hebasto). Even though the tests aren't performance critical, getting rid of these warnings (for which the checks were already enabled via https://github.com/bitcoin/bitcoin/blob/master/src/.clang-tidy#L18, see below), the fix was quite simple. <details> <summary>clang-tidy -list-checks</summary> ```bash cd src && clang-tidy -list-checks | grep 'vector' performance-inefficient-vector-operation ``` </details> <details> <summary>Output before the change</summary> ``` src/test/rpc_tests.cpp:434:9: error: 'emplace_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors] 433 | for (int64_t i = 0; i < 100; i++) { 434 | feerates.emplace_back(1 ,1); | ^ src/test/checkqueue_tests.cpp:366:13: error: 'emplace_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors] 365 | for (size_t i = 0; i < 3; ++i) { 366 | tg.emplace_back( | ^ src/test/cuckoocache_tests.cpp:231:9: error: 'emplace_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors] 228 | for (uint32_t x = 0; x < 3; ++x) 229 | /** Each thread is emplaced with x copy-by-value 230 | */ 231 | threads.emplace_back([&, x] { | ^ src/rpc/output_script.cpp:127:17: error: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors] 126 | for (unsigned int i = 0; i < keys.size(); ++i) { 127 | pubkeys.push_back(HexToPubKey(keys[i].get_str())); | ^ ``` And the fuzz and benchmarks, noticed by hebasto: bitcoin#31305 (comment) </details> ACKs for top commit: maflcko: review ACK 11f3bc2 🎦 achow101: ACK 11f3bc2 theuni: ACK 11f3bc2 hebasto: ACK 11f3bc2, tested with clang 19.1.5 + clang-tidy. Tree-SHA512: 41691c19f35c63b922a95407617a54f9bff1af3f95f99d15642064f321df038aeb1ae5f061f854ed913f69036807cc28fa6222b2ff4c24ef43b909027fa0f9b3
e0287bc test: remove unused code from script_tests (fanquake) Pull request description: This has been unused since bitcoin#29648. Noticed while running a newer version of clang-tidy (19.1.1): ```bash [127/391][6.2s] /opt/homebrew/opt/llvm/bin/clang-tidy -p=build -quiet --config-file=/bitcoin/src/.clang-tidy /bitcoin/src/test/script_tests.cpp bitcoin/src/test/script_tests.cpp:126:25: error: local copy 'tx2' of the variable 'tx' is never modified and never used; consider removing the statement [performance-unnecessary-copy-initialization,-warnings-as-errors] 126 | CMutableTransaction tx2 = tx; | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ 127 | BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, &scriptWitness, flags, MutableTransactionSignatureChecker(&tx, 0, txCredit.vout[0].nValue, MissingDataBehavior::ASSERT_FAIL), &err) == expect, message); 512 warnings generated. ``` ACKs for top commit: maflcko: review ACK e0287bc BrandonOdiwuor: ACK e0287bc Tree-SHA512: f69513d0b898e0e9afad047bcec200707b057e3718a3d35bd479a788a1973e49ee7e5f48feadb8731ab5fdbd12a2b53b0bcf65296701e2296c3fdb67cdcabfb5
BACKPORT NOTE: This file is missing to be backported: ci/test/00_setup_env_native_tidy.sh Missing changes from contrib/devtools/iwyu/bitcoin.core.imp 31e59d9 iwyu: Drop backported mapping (Hennadii Stepanov) fe9bc5a ci: Update Clang in "tidy" job (Hennadii Stepanov) Pull request description: This PR switches to the latest [IWYU 0.23](https://github.com/include-what-you-use/include-what-you-use/releases/tag/0.23), which is compatible with Clang 19. New "bugprone-use-after-move" and "modernize-use-starts-ends-with" warnings that emerged have been addressed. ACKs for top commit: maflcko: lgtm ACK 31e59d9 l0rinc: ACK 31e59d9 theuni: ACK 31e59d9 Tree-SHA512: ae0ca150673e1bfa78664f2ef35dbc965094b32374cafeeae390c6d368c28169a7f7790debe9a6eeb5efc39c9a468f5032d92f30cc4032b09d8265f6a75de882
multiple failures due to upgrade to clang-19, see #6995 Seems as CI for clang-tidy succeed https://github.com/dashpay/dash/actions/runs/19681244038/job/56375780355?pr=6980 PR is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/validation.cpp (1)
2157-2161: Reference binding tomnlist_updates_opt.value()inDisconnectBlockis safe; consider making itconst
mnlist_updates_optis a localstd::optionalthat outlives theifblock, andmnluis only used for read-only notification calls, soauto& mnlu = mnlist_updates_opt.value();correctly avoids a copy without changing behavior. For consistency withConnectBlockand const‑correctness, you could change this toconst auto& mnlu = …as well.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
contrib/devtools/iwyu/bitcoin.core.imp(1 hunks)src/bench/prevector.cpp(2 hunks)src/bitcoin-tx.cpp(5 hunks)src/core_read.cpp(2 hunks)src/evo/deterministicmns.cpp(1 hunks)src/evo/specialtxman.cpp(2 hunks)src/governance/object.cpp(1 hunks)src/instantsend/net_instantsend.cpp(1 hunks)src/llmq/signing_shares.cpp(1 hunks)src/masternode/meta.cpp(1 hunks)src/qt/bitcoinunits.cpp(1 hunks)src/test/checkqueue_tests.cpp(1 hunks)src/test/coins_tests.cpp(1 hunks)src/test/cuckoocache_tests.cpp(1 hunks)src/test/fuzz/txorphan.cpp(1 hunks)src/test/fuzz/util.h(2 hunks)src/test/result_tests.cpp(1 hunks)src/test/rpc_tests.cpp(1 hunks)src/test/script_tests.cpp(3 hunks)src/test/validation_block_tests.cpp(1 hunks)src/torcontrol.cpp(2 hunks)src/validation.cpp(2 hunks)src/wallet/scriptpubkeyman.cpp(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- contrib/devtools/iwyu/bitcoin.core.imp
🚧 Files skipped from review as they are similar to previous changes (4)
- src/bitcoin-tx.cpp
- src/test/fuzz/txorphan.cpp
- src/test/validation_block_tests.cpp
- src/test/script_tests.cpp
🧰 Additional context used
📓 Path-based instructions (12)
src/**/*.{cpp,h,hpp,cc}
📄 CodeRabbit inference engine (CLAUDE.md)
Dash Core implementation must be written in C++20, requiring at least Clang 16 or GCC 11.1
Files:
src/test/cuckoocache_tests.cppsrc/qt/bitcoinunits.cppsrc/test/fuzz/util.hsrc/test/checkqueue_tests.cppsrc/evo/specialtxman.cppsrc/llmq/signing_shares.cppsrc/test/coins_tests.cppsrc/governance/object.cppsrc/bench/prevector.cppsrc/validation.cppsrc/wallet/scriptpubkeyman.cppsrc/core_read.cppsrc/masternode/meta.cppsrc/instantsend/net_instantsend.cppsrc/evo/deterministicmns.cppsrc/torcontrol.cppsrc/test/rpc_tests.cppsrc/test/result_tests.cpp
src/{test,wallet/test}/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Unit tests in src/test/ and src/wallet/test/ must use Boost::Test framework
Files:
src/test/cuckoocache_tests.cppsrc/test/fuzz/util.hsrc/test/checkqueue_tests.cppsrc/test/coins_tests.cppsrc/test/rpc_tests.cppsrc/test/result_tests.cpp
src/qt/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
GUI implementation in src/qt/ must use Qt 5
Files:
src/qt/bitcoinunits.cpp
src/{masternode,evo}/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Masternode lists must use immutable data structures (Immer library) for thread safety
Files:
src/evo/specialtxman.cppsrc/masternode/meta.cppsrc/evo/deterministicmns.cpp
src/{masternode,evo,llmq,governance,coinjoin}/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Use Dash-specific database implementations: CFlatDB for persistent storage (MasternodeMetaStore, GovernanceStore, SporkStore, NetFulfilledRequestStore) and CDBWrapper extensions for Evolution/DKG/InstantSend/Quorum/RecoveredSigs data
Files:
src/evo/specialtxman.cppsrc/llmq/signing_shares.cppsrc/governance/object.cppsrc/masternode/meta.cppsrc/evo/deterministicmns.cpp
src/evo/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Special transactions use payload serialization routines defined in src/evo/specialtx.h and must include appropriate special transaction types (ProRegTx, ProUpServTx, ProUpRegTx, ProUpRevTx)
Files:
src/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
src/{masternode,llmq,evo,coinjoin,governance}/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Use unordered_lru_cache for efficient caching with LRU eviction in Dash-specific data structures
Files:
src/evo/specialtxman.cppsrc/llmq/signing_shares.cppsrc/governance/object.cppsrc/masternode/meta.cppsrc/evo/deterministicmns.cpp
src/{masternode,llmq}/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
BLS integration must be used for cryptographic foundation of advanced masternode features
Files:
src/llmq/signing_shares.cppsrc/masternode/meta.cpp
src/llmq/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
src/llmq/**/*.{cpp,h}: LLMQ quorums must support multiple configurations (50/60, 400/60, 400/85) for different services (ChainLocks, InstantSend, governance voting)
InstantSend implementation must provide distributed key generation for secure transaction locking with quorum consensus
ChainLocks implementation must prevent reorganizations and provide block finality through 51% attack prevention
Files:
src/llmq/signing_shares.cpp
src/governance/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Governance implementation must support governance objects (proposals, triggers, superblock management) and on-chain voting with tallying
Files:
src/governance/object.cpp
src/bench/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Performance benchmarks in src/bench/ must use the nanobench library
Files:
src/bench/prevector.cpp
src/wallet/**/*.{cpp,h}
📄 CodeRabbit inference engine (CLAUDE.md)
Wallet implementation must use Berkeley DB and SQLite
Files:
src/wallet/scriptpubkeyman.cpp
🧠 Learnings (12)
📓 Common learnings
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: The univalue library (in src/univalue/) is no longer a vendored external dependency but is now part of the Bitcoin Core codebase and can be modified as needed during backports.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/evo/evodb/**/*.{cpp,h} : Evolution Database (CEvoDb) must handle masternode snapshots, quorum state, governance objects with efficient differential updates for masternode lists
Applied to files:
src/evo/specialtxman.cppsrc/validation.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/evo/**/*.{cpp,h} : Special transactions use payload serialization routines defined in src/evo/specialtx.h and must include appropriate special transaction types (ProRegTx, ProUpServTx, ProUpRegTx, ProUpRevTx)
Applied to files:
src/evo/specialtxman.cpp
📚 Learning: 2025-11-13T20:02:55.480Z
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6969
File: src/evo/deterministicmns.h:441-479
Timestamp: 2025-11-13T20:02:55.480Z
Learning: In `src/evo/deterministicmns.h`, the `internalId` field in `CDeterministicMN` and the `mnInternalIdMap` in `CDeterministicMNList` are non-deterministic and used only for internal bookkeeping and efficient lookups. Different nodes can assign different internalIds to the same masternode depending on their sync history. Methods like `IsEqual()` intentionally ignore internalId mappings and only compare consensus-critical deterministic fields (proTxHash, collateral, state, etc.).
Applied to files:
src/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/llmq/**/*.{cpp,h} : InstantSend implementation must provide distributed key generation for secure transaction locking with quorum consensus
Applied to files:
src/llmq/signing_shares.cppsrc/instantsend/net_instantsend.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/coinjoin/**/*.{cpp,h} : CoinJoin implementation must use masternode-coordinated mixing sessions with uniform denomination outputs
Applied to files:
src/test/coins_tests.cpp
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/wallet/scriptpubkeyman.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/llmq/**/*.{cpp,h} : ChainLocks implementation must prevent reorganizations and provide block finality through 51% attack prevention
Applied to files:
src/instantsend/net_instantsend.cpp
📚 Learning: 2025-01-02T21:50:00.967Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6504
File: src/llmq/context.cpp:42-43
Timestamp: 2025-01-02T21:50:00.967Z
Learning: LLMQContext manages concurrency for the `CInstantSendManager`. Previously, this was handled globally; now it's handled as a class member in `LLMQContext`, but the concurrency control remains consistent.
Applied to files:
src/instantsend/net_instantsend.cpp
📚 Learning: 2025-01-07T18:50:44.838Z
Learnt from: knst
Repo: dashpay/dash PR: 6511
File: src/evo/deterministicmns.cpp:1369-1373
Timestamp: 2025-01-07T18:50:44.838Z
Learning: The functions `MigrateDBIfNeeded` and `MigrateDBIfNeeded2` in `src/evo/deterministicmns.cpp` are temporary and will be removed in a future version. Refactoring suggestions for these functions should be avoided.
Applied to files:
src/evo/deterministicmns.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h} : Masternode lists must use immutable data structures (Immer library) for thread safety
Applied to files:
src/evo/deterministicmns.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/{test,wallet/test}/**/*.{cpp,h} : Unit tests in src/test/ and src/wallet/test/ must use Boost::Test framework
Applied to files:
src/test/result_tests.cpp
🧬 Code graph analysis (2)
src/evo/specialtxman.cpp (1)
src/evo/deterministicmns.h (1)
nHeight(148-181)
src/governance/object.cpp (1)
src/rpc/governance.cpp (3)
objResult(141-141)objResult(639-639)objResult(800-800)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: linux64_ubsan-test / Test source
- GitHub Check: linux64_tsan-test / Test source
🔇 Additional comments (25)
src/test/rpc_tests.cpp (1)
442-447: Preallocation withreserve(200)is correct and matches test usage
feeratesgrows to 200 elements in the first scenario and never beyond that; reserving 200 avoids reallocations without changing behavior. Looks good, especially as a faithful backport.src/test/cuckoocache_tests.cpp (1)
219-237: Preallocatingthreadsis correct and improves test robustness slightlyReserving capacity for exactly 3 threads before
emplace_backavoids reallocations/moves during thread creation and keeps behavior unchanged. This is a safe, tidy micro-optimization and aligns well with the backport’s intent.src/test/checkqueue_tests.cpp (1)
384-403: Reservingtgcapacity is a safe micro-optimizationCalling
tg.reserve(3)before launching the three threads avoids vector growth duringemplace_backwithout changing the test’s locking semantics or behavior. Looks good as-is.src/test/fuzz/util.h (2)
146-155: Pre-reserving capacity for string vector is correct and behavior‑preservingUsing
r.reserve(n_elements);before the loop avoids reallocations and does not change semantics, sincen_elementsis already the upper bound on pushes (including the 0 case). This fits the backport’s perf-only scope.
157-167: Integral vectorreserveis likewise safe and consistentAnalogous to the string helper,
r.reserve(n_elements);for the integral vector is a pure performance improvement with no observable behavior change, given the existingn_elementsbound.src/masternode/meta.cpp (1)
205-205: LGTM! Valid optimization.The change from
inserttoemplaceenables in-place construction of the cache entry, avoiding potential temporary object creation while maintaining identical semantics. This aligns with the PR's objective of improving move semantics and reducing unnecessary copies.src/test/coins_tests.cpp (1)
763-768: LGTM – Const lvalue references are appropriate here.The switch from forwarding references (
Args&&...+std::forward) to const lvalue references (const Args&...) is semantically correct for this test helper. All arguments passed toCheckAddCoinare literals of trivially copyable types (CAmount,char,bool), andCheckAddCoinBaseaccepts them by value. Perfect forwarding provided no benefit in this context.src/bench/prevector.cpp (2)
110-120: LGTM: Good benchmark optimization.The
reserve(260)call correctly pre-allocates capacity to match the loop iterations, ensuring the benchmark measures prevector operations rather than vector reallocations.
123-134: LGTM: Good benchmark optimization.The
reserve(260)call correctly pre-allocates capacity to match the loop iterations, ensuring the benchmark measures prevector operations rather than vector reallocations.src/test/result_tests.cpp (1)
61-69: ExpectSuccess change is correct and move‑friendlyCreating a local
T expected{std::forward<Args>(args)...};and comparingresult.value()to it preserves the original semantics, works cleanly with move‑only types likeNoCopy, and avoids any unnecessary copies. This looks good and fits the existing Boost.Test usage in this file.src/torcontrol.cpp (1)
353-365: Prefix checks converted tostarts_withare behavior‑preservingUsing
line.starts_with("net/listeners/socks=")andportstr.starts_with("127.0.0.1:")keeps the original prefix semantics and improves clarity without changing control flow or fallback behavior. Looks good as‑is.src/core_read.cpp (2)
36-44: C++20starts_withusage in opcode parsing looks correctUsing
strName.starts_with("OP_")is clearer than a manual prefix compare and is valid under the project’s C++20 requirement. No behavioral change versus the prior prefix check, and the short-name mapping logic remains intact.If any non-standard build configurations still compile with a pre-C++20 standard, please confirm they are updated so this continues to compile everywhere. Based on learnings, keeping behavior identical to upstream backport is appropriate here.
184-198: Bindingsighash.get_str()toconst std::string&is safe and avoids a copy
const std::string& strHashType = sighash.get_str();safely leverages lifetime extension of the prvalue result and removes an unnecessary copy; lookup inmap_sighash_valuesis unchanged functionally.Please confirm that
UniValue::get_str()continues to returnstd::stringby value in this backport series; if its signature ever changes, this pattern should be revisited. No change requested now to keep the backport aligned with upstream, based on learnings.src/wallet/scriptpubkeyman.cpp (2)
399-419: Usingconst auto&forvMasterKeyis safe and avoids an unnecessary copy
vMasterKeynow aliases the optional’s value with const reference; the optional outlives this block, and the existing size check and EncryptHDChain call semantics remain unchanged while avoiding a copy ofCKeyingMaterial.
1924-1939: Iteratingm_map_crypted_keysbyconst auto&improves efficiency without changing behaviorSwitching the loop to
for (const auto& key_pair : m_map_crypted_keys)removes redundant copies of map entries while leaving the decryption flow and returned key map semantics intact.src/llmq/signing_shares.cpp (1)
633-639: LGTM! Efficient move semantics optimization.The refactoring correctly eliminates unnecessary copies by binding
sigShareas a reference and usingstd::movefor ownership transfer tosession.sigShare. The change is safe because:
ProcessSigSharetakes a const reference and doesn't modify the object- No use-after-move issues exist since
sigShareisn't accessed after line 639- The move is conditionally applied only when storing in
signedSessionsThis aligns well with the PR's objective of reducing copies across the codebase.
src/governance/object.cpp (1)
273-274: LGTM! Efficient const reference binding avoids unnecessary copies.The change from by-value to const reference binding eliminates unnecessary vector copies while maintaining correctness. The lifetime of the referenced objects is guaranteed to exceed the lifetime of the references, and the logic remains unchanged.
src/instantsend/net_instantsend.cpp (1)
236-245: Behavior-preserving move/forwarding cleanup looks correctUsing
still_pending.emplace_back(std::move(p));correctly moves each pair fromlocks_to_process, and passingstill_pendingas an lvalue intoProcessPendingInstantSendLocks(which takes aconst std::vector<>&) removes a misleadingstd::movewith no semantic cost. No lifetime or correctness issues:locks_to_processis not used after the loop, andstill_pendingis only read in the subsequent call.src/evo/deterministicmns.cpp (1)
1839-1839: LGTM! Copy assignment is appropriate for Immer-based immutable data structures.The use of copy assignment instead of move is correct here. Based on the coding guidelines, CDeterministicMNList uses Immer's immutable data structures for thread safety, which rely on structural sharing to make copies efficient. Traditional C++ move semantics may not be applicable or beneficial for such persistent data structures.
The TODO comment notes future work to make the class moveable, but this may require careful design consideration given the Immer library's semantics.
src/qt/bitcoinunits.cpp (1)
185-199: Bindingwholeasconst QString&is safe and avoids an extra copy
partsis a localQStringListand is never mutated after construction, soparts[0]remains valid for the lifetime ofwhole. This change just removes a redundant copy with no behavioral impact.src/validation.cpp (1)
2708-2712: Const-reference binding inConnectBlockcorrectly avoids copyingMNListUpdates
const auto& mnlu = mnlist_updates_opt.value();is guarded byhas_value()and used only within the block, so the reference is lifetime-safe and removes an unnecessary copy while preserving behavior of the masternode list notifications.src/evo/specialtxman.cpp (4)
194-194: LGTM: Unnecessary intermediate copy removed.The direct initialization of
newListfromprevListeliminates the redundant intermediateoldListvariable, reducing from two copy operations to one. SinceCDeterministicMNListuses Immer's immutable data structures (per coding guidelines for masternode lists), this copy is efficient and the change is purely an optimization.
198-198: LGTM: Consistent with removal of oldList.Using
prevList.GetMNPayeeinstead of the removedoldList.GetMNPayeeis functionally equivalent sinceoldListwas simply a copy ofprevListat this point.
200-216: LGTM: Code and comments now consistent.The updated iteration over
prevList(instead ofoldList) aligns with the updated comments. The safety of iteratingprevListwhile modifyingnewListis ensured by:
newListbeing a structural copy ofprevListvia Immer's immutable data structuresprevListbeing a const reference parameter that cannot be modified- The iteration occurring before any divergence between the two lists
505-505: Based on the learnings provided and the context in the review comment, I can now generate the rewritten review:Remove std::move at line 505 to align with PR's broader refactoring pattern favoring direct copies.
The change from
mnListRet = std::move(newList)tomnListRet = newListremoves move semantics. While this appears counter-intuitive sincenewListgoes out of scope immediately, the performance impact is negligible becauseCDeterministicMNListuses Immer's immutable data structures with efficient structural sharing (copy is O(1)). The AI summary indicates this aligns with an intentional refactoring pattern throughout the PR. Per the backport process, such changes should match upstream exactly, even when they appear unusual.
UdjinM6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 001493a
kwvg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 001493a
851697f fix: make clang-tidy happy (UdjinM6) Pull request description: ## Issue being fixed or feature implemented clang-tidy complains in develop https://github.com/dashpay/dash/actions/runs/19766627745/job/56641081222 #6980 follow-up ## What was done? Apply missing changes ## How Has This Been Tested? https://github.com/UdjinM6/dash/actions/runs/19767082677/job/56642583627 ## Breaking Changes n/a ## Checklist: - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: knst: utACK 851697f Tree-SHA512: deaef3dc36a1eed9a2e0f0fb232a3212f46c54a6e0ae9fa070fc26c88a18044e00b4df4f52d9a5a6d813f4e9de9efe56ae3ade5054b8137668bb656ee46edb22
What was done?
Some more regular backports from Bitcoin Core v24; some extra backports have been pulled from Bitcoin Core v29 to fix clang-tidy for newer clang-19
How Has This Been Tested?
Run unit & functional tests
Breaking Changes
N/A
Checklist: